oci_error() returns false after oci_new_collection() fails

Bug #42134 oci_error() returns false after oci_new_collection() fails
Submitted: 2007-07-28 21:40 UTC Modified: 2007-07-31 19:21 UTC
From: sixd@php.net Assigned:
Status: Closed Package: OCI8 related
PHP Version: 5CVS-2007-07-28 (CVS) OS: n/a
Private report: No CVE-ID: None

 [2007-07-28 21:40 UTC] sixd@php.net

Description:
------------
Collection creation errors are displayed if display_errors and
error_reporting are set appropriately, but a subsequent oci_error()
returns false, so error trapping won't display the problem.

After OCITypeByName() fails in php_oci_collection_create(),
php_oci_collection_close() is called.  The line
  zend_list_delete(collection->connection->rsrc_id)
causes the subsequent oci_error() function line
  connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
to return a null pointer.


Reproduce code:
---------------
<?php
$c = oci_connect('hr', 'hrpwd', '//localhost/XE');

$collection = oci_new_collection($c, "BOGUS");
if (!$collection) {
    $m = oci_error($c);
    echo "Error: ", $m["message"];
}
?>

Expected result:
----------------
  Error: OCI-22303: type ""."BOGUS" not found

Actual result:
--------------
  Error:

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2007-07-31 19:21 UTC] tony2001@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.