|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-04-15 18:20 UTC] fsurleau at skyservices dot net
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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 08:00:01 2025 UTC |
Reproduce bad_query.php code is : $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(); The collection.php code is : $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(); It was cut at first post...