ID:               32722
 Updated by:       [EMAIL PROTECTED]
 Reported By:      fsurleau at skyservices dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         OCI8 related
 Operating System: linux
 PHP Version:      4.3.11
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

AFAIK, this might be fixed in PHP 5.1-dev..



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

[2005-04-15 18:20:53] 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.


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


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

Reply via email to