|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-11-25 17:15 UTC] joe at thook dot me
Description: ------------ Behavior seems similar to this (resolved) issue: https://bugs.php.net/bug.php?id=42134 Project using ZF1 fails to handle ORA-00001 (Unique constraint violation) warning as an error. 1. SQL statement is sent to Oracle DB adapter using OCI driver (2.0.8) 2. oci_execute() of INSERT statement would cause unique constraint violation, statement fails correctly. 3. PHP Warning is issued (verified with FirePHP and in Apache logs). PHP error_reporting is E_ALL on this development server. 4. ZF1 attempts to generate Exception thus: throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt)); 5. oci_error returns false. Exception is not generated correctly because error array is not produced. Expected result: ---------------- When oci_execute() throws ORA-00001 and issues a PHP Warning, oci_error should produce the error array in accordance with PHP's error_reporting setting. Actual result: -------------- oci_error() returns false despite Warning issued. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
Looks OK in my testcase. <?php /* create table cjt (c1 number unique); insert into cj1 values (1); commit; */ error_reporting(E_ALL); ini_set('display_errors', 'Off'); $c = oci_connect('hr', 'welcome', 'localhost/orcl'); if (!$c) { $m = oci_error(); trigger_error('oci_connect error: Could not connect to database: '. $m['message'], E_USER_ERROR); } $s = oci_parse($c, "insert into cjt values (1)"); if (!$s) { $m = oci_error($c); trigger_error('oci_parse error: Could not parse statement: '. $m['message'], E_USER_ERROR); } $r = oci_execute($s); if (!$r) { $m = oci_error($s); trigger_error('oci_execute error: Could not execute statement: '. $m['message'], E_USER_ERROR); } ?> Gives: $ php56 uc.php PHP Warning: oci_execute(): ORA-00001: unique constraint (HR.SYS_C0010813) violated in uc.php on line 25 PHP Fatal error: oci_execute error: Could not execute statement: ORA-00001: unique constraint (HR.SYS_C0010813) violated in uc.php on line 28