#39352 [Com]: oci_close fails with global keyword

From: Date: Mon, 06 Nov 2006 08:50:32 +0000
Subject: #39352 [Com]: oci_close fails with global keyword
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104491@lists.php.net to get a copy of this message
ID: 39352 Comment by: anon at anon dot com Reported By: david at acz dot org Status: Assigned Bug Type: OCI8 related Operating System: SuSE Linux 9.3 PHP Version: 5.2.0 Assigned To: tony2001 New Comment: reproduced on Windows 2003 server, using Nov 2 release of 5.2.0 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#104491) next »