From: powerblade at mail dot dk
Operating system: Windows XP
PHP version: 5CVS-2004-03-24 (dev)
PHP Bug Type: *General Issues
Bug description: oci_error() doesn't return a error if oci_execute() errored.
Description:
------------
When executing a statement it goes as this:
oci_parse() - Validates the SQL statement. However this always returns
true so it can't be trusted.
oci_execute() - Executes the query. If anything goes wrong, it simply
outputs it to the screen. If you put a @ infront to avoid the warning and
then use oci_error() to get the error, you don't get the error string it
outputs to the screen.
Reproduce code:
---------------
$query = 'XYZZYX'; /* Invalid SQL string */
$stmt = oci_parse($this->connection, $query);
$aError = oci_error();
if($aError)
{
throw new DatabaseException("[".$aError['code']."] Can't parse query.
".$aError['message']);
}
$return = oci_execute($stmt);
if($return === FALSE)
{
$aError = @oci_error();
throw new DatabaseException("[".$aError['code']."] Can't execute
query. ".$aError['message']);
}
Expected result:
----------------
Uncaught exception with the string:
[error code] Can't parse query. [error msg]
or
[error code] Can't execute query. [error msg]
Actual result:
--------------
Uncaught exception with the string:
[] Can't execute query []
--
Edit bug report at http://bugs.php.net/?id=27672&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27672&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27672&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27672&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27672&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27672&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27672&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27672&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27672&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27672&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27672&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27672&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27672&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27672&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27672&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27672&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27672&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27672&r=float