ID:               39352
 User updated by:  david at acz dot org
 Reported By:      david at acz dot org
-Status:           Bogus
+Status:           Open
-Bug Type:         OCI8 related
+Bug Type:         Scripting Engine problem
 Operating System: SuSE Linux 9.3
 PHP Version:      5.2.0
 Assigned To:      tony2001
 New Comment:

Changing category.


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

[2006-11-08 10:08:45] [EMAIL PROTECTED]

Actually this has nothing to do with OCI8, as this is the way PHP
handles resources.
You can do the same trick with MySQL and it won't actually close the
connection when using global variable, but it will work with $GLOBALS.


------------------------------------------------------------------------

[2006-11-06 08:50:31] anon at anon dot com

reproduced on Windows 2003 server, using Nov 2 release of 5.2.0

------------------------------------------------------------------------

[2006-11-02 22:54:38] david at acz dot org

Description:
------------
oci_close() fails if the connection resource is a global accessed via
the "global" keyword, but works if accessed using the $GLOBALS array.

Reproduce code:
---------------
$conn = oci_connect(DB_USER, DB_PASS, DB_NAME);
var_dump($conn);

global_keyword();
global_array();

function global_keyword()
{
    global $conn;
    var_dump($conn);
    oci_close($conn);  // this seems to do nothing
    var_dump($conn);
}

function global_array()
{
    var_dump($GLOBALS["conn"]);
    oci_close($GLOBALS["conn"]);  // this works
    var_dump($GLOBALS["conn"]);
}


Expected result:
----------------
resource(8) of type (oci8 connection)
resource(8) of type (oci8 connection)
NULL
NULL
PHP Warning: oci_close() expects parameter 1 to be resource, null
given
NULL


Actual result:
--------------
resource(8) of type (oci8 connection)
resource(8) of type (oci8 connection)
resource(8) of type (oci8 connection)
resource(8) of type (oci8 connection)
NULL



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39352&edit=1

Reply via email to