Doc #51291 [NEW]: oci_error dont report last error when called two times
| From: | sumariva at gmail dot com | Date: | Sat, 13 Mar 2010 15:04:36 +0000 |
| Subject: | Doc #51291 [NEW]: oci_error dont report last error when called two times | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-4040@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:oci_error dont report last error when called two times
Description:
------------
The documentation should add a note that the function or oracle
change/resets the oracle error flag at each call when a resource statement
passed in. If you call it two times with same statement resource parameter
the second call get no error.
Test script:
---------------
<?php $ociUser = 'system';
$ociPass = 'mudar123';
$hostAddress = '192.168.1.43';
$ociConnString =
'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST='.$hostAddress.')(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)))';
$ociDbHandler = oci_connect( $ociUser, $ociPass, $ociConnString );
if ( !$ociDbHandler )
{ #call oci_error without args to check for connection errors
var_dump( __LINE__, oci_error() );
exit();
}
//sample from website
$stmt = @oci_parse( $ociDbHandler, "select ' from dual"); // note
mismatched quote
if ( !$stmt )
{
var_dump( __LINE__, oci_error( $ociDbHandler ) ); // For oci_parse errors
pass the connection handle
var_dump( __LINE__, oci_error( $ociDbHandler ) );
}
$stmt = 'select TABLE_NAME from ALL_TAB_COLUMNS, ALL_TAB_COLUMNS clone
where ALL_TAB_COLUMNS.TABLE_NAME = clone.TABLE_NAME';
$stmt = @oci_parse( $ociDbHandler, $stmt );
$flag = @oci_execute( $stmt, OCI_DEFAULT ); // note duplicated column
name
if ( !$flag )
{ #here the error message is not displayed on second call
var_dump( __LINE__, oci_error(), oci_error( $ociDbHandler ), oci_error(
$stmt ), $stmt ); // For oci_parse errors pass the connection handle
var_dump( __LINE__, oci_error(), oci_error( $ociDbHandler ), oci_error(
$stmt ), $stmt ); // For oci_parse errors pass the connection handle
exit;
}
exit( 'end' ); ?>
Expected result:
----------------
Expected that each call on same resource reported the same errors.
Actual result:
--------------
int(27) bool(false) bool(false) array(4) { ["code"]=> int(918)
["message"]=> string(37) "ORA-00918: column ambiguously defined"
["offset"]=> int(7) ["sqltext"]=> string(113) "select TABLE_NAME from
ALL_TAB_COLUMNS, ALL_TAB_COLUMNS clone where ALL_TAB_COLUMNS.TABLE_NAME =
clone.TABLE_NAME" } resource(2) of type (oci8 statement)
int(28) bool(false) bool(false) bool(false) resource(2) of type (oci8
statement)
--
Edit bug report at http://bugs.php.net/bug.php?id=51291&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51291&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51291&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51291&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51291&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51291&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51291&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51291&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51291&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51291&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51291&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51291&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51291&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51291&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51291&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51291&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51291&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51291&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51291&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51291&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51291&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51291&r=mysqlcfg