From: fsurleau at skyservices dot net Operating system: linux PHP version: 4.3.11 PHP Bug Type: OCI8 related Bug description: OCINewCollection hang after parse error.
Description: ------------ Using OCI persistant connections, I found the folowing bug : In case, there is a bug in one of my queries generating a parse error : "ORA-01756: quoted string not properly terminated", then, the next web request reusing the connection will have an "OCI-21522: attempted to use an invalid connection in OCI (object mode only)" error at OCINewCollection call. This bug occurs only if OCINewCollection was never used for the persistant connection. So a workaround is to call OCINewCollection, immediately after OCIPLogon. Of course the best is to only have correct SQL requests ;-) Steps to reproduce the bug : 1- Stop and restart apache to kill all persistant connections. 2- Request for bad_query.php, and write down the PID. 3- Request for collection.php, and write down the PID. If the PIDs are the same, collection.php will hang with OCI-21522 error. If the PIDs are not the same, try again. Now, try again, but run first collection.php : 1- Stop and restart apache to kill all persistant connections. 2- Request for collection.php, and write down the PID. 3- Request for bad_query.php, and write down the PID. If the PID are the same, now each time you request collection.php, it will not hang for the PID you wrote down. Regards, F.SURLEAU Reproduce code: --------------- // bad_query.php <?php $cnx = ociPLogon( $user, $pass, $db_name ); if( ! @ociparse( $cnx, "select sysdate from dual where 'xxxxxx'='xxx\\'xxx'" ) ) { $oerr = OCIError( $cnx ); echo "Error in statement : ".$oerr['message'] . "<br><br>"; } echo "PID=" . getmypid(); ?> // collection.php <?php $cnx = ociPLogon( $user, $pass, $db_name ); if( @OCINewCollection( $cnx, "MY_COLLECTION_TYPE" ) ) { $oerr = OCIError( $cnx ); echo "Error for collection : " . $oerr['message'] . "<br><br>"; } else { echo "OK for collection .<br><br>"; } echo "PID=" . getmypid(); ?> Expected result: ---------------- ORA-01756: quoted string not properly terminated Actual result: -------------- ORA-01756: quoted string not properly terminated and OCI-21522: attempted to use an invalid connection in OCI (object mode only) in some special cases. -- Edit bug report at http://bugs.php.net/?id=32722&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32722&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32722&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32722&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32722&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32722&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32722&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32722&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32722&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32722&r=support Expected behavior: http://bugs.php.net/fix.php?id=32722&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32722&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32722&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32722&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32722&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32722&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32722&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32722&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32722&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32722&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32722&r=mysqlcfg