ID:               45982
 Updated by:       [EMAIL PROTECTED]
 Reported By:      skonev at september dot ru
-Status:           Open
+Status:           Bogus
 Bug Type:         Variables related
 Operating System: GNU/Linux Ubuntu 8.04.1
 PHP Version:      5.2.6
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You're keeping a constant version of the resource pointer, resources in
constants aren't really supported.


Previous Comments:
------------------------------------------------------------------------

[2008-09-03 13:15:35] skonev at september dot ru

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 this bug report at http://bugs.php.net/?id=45982&edit=1

Reply via email to