From:             skonev at september dot ru
Operating system: GNU/Linux Ubuntu 8.04.1
PHP version:      5.2.6
PHP Bug Type:     Variables related
Bug description:  The constant crash at start mysql_close(constant) from 
function

Description:
------------
1. Constant LINK is set. 
2. In a file login.php before function "auth" I check that constant LINK
exists: 
resource (4) of type (mysql link) 
3. Function "auth" from a file login.php is started. 
4. In the function beginning I check that constant LINK exists: resource
(4) of type (mysql link)
5. I close connection mysql_close(LINK);
6. After mysql_close(LINK) I check that constant LINK exists: 
a constant is damaged: resource (4) of type (Unknown).

Reproduce code:
---------------
configdb.php
define ('DBHOST', "localhost");
define ('DBUSER', "root");
define ('DBPASSWORD', "xxxxx");
define ('DBNAME', "base1");
define ('LINK', mysql_connect(DBHOST, DBUSER,DBPASSWORD));
----------------

login.php
var_dump(LINK); // resource(4) of type (mysql link)
if (isset($_POST["confirmForm"]) && !empty($_POST["confirmForm"])){
        auth($_POST["nameForm"], $_POST["passwordForm"]);}
var_dump(LINK);// resource(4) of type (Unknown)
----------------

lib.php
function auth($name, $password){
    var_dump(LINK); // resource(4) of type (mysql link)
    $query = "select count(*) from Names where name='$name' and
password=MD5('$password')";
    $result=mysql_query($query, LINK);
    $row=mysql_fetch_array($result);
  resource(4) of type (mysql link)
    mysql_close(LINK);
    var_dump(LINK);// resource(4) of type (Unknown)}


Expected result:
----------------
I want that constant LINK did not change after mysql_close(LINK).
I want that after run mysql_close(LINK): resource(4) of type (mysql link)

Actual result:
--------------
resource(4) of type (Unknown) 

-- 
Edit bug report at http://bugs.php.net/?id=45982&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45982&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45982&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45982&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45982&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45982&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45982&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45982&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45982&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45982&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45982&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45982&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45982&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45982&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45982&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45982&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45982&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45982&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45982&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45982&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45982&r=mysqlcfg

Reply via email to