Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #9780 Mdb2 Oracle Driver getMessage() returns an array
Submitted: 2007-01-09 07:24 UTC
From: pcdinh at gmail dot com Assigned: quipo
Status: Closed Package: MDB2_Driver_oci8 (version 1.3.0)
PHP Version: 5.2.0 OS: Windows Xp Sp2
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 45 - 19 = ?

 
 [2007-01-09 07:24 UTC] pcdinh at gmail dot com (Dinh)
Description: ------------ There is a bug in Oracle driver for MDB2 that affects the behaviour of the method getMessage(). I tried to execute a wrong SQL syntax statement and expected getMessage() will return a meaningful error notice. However I have got as follows: MDB2 Error: Array I tried to var_dump() MDB2_Error and found: object(MDB2_Error)#12 (8) { ["error_message_prefix"]=> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024) ["code"]=> NULL ["message"]=> string(17) "MDB2 Error: Array" ["userinfo"]=> string(224) "_doQuery: [Error message: Could not execute statement] [Last executed query: select PRIMARY_SHORT_COMPANY_NAME from wvb_company where company_perm_id #= 454] [Native code: 911] [Native message: ORA-00911: invalid character] " ["backtrace"]=> array(13) { [0]=> array(7) { ["file"]=> string(31) "D:\wvbsrc\library\pear\MDB2.php" ["line"]=> int(961) ["function"]=> string(10) "PEAR_Error" ["class"]=> string(10) "PEAR_Error" ["object"]=> object(MDB2_Error)#12 (8) { ["error_message_prefix"]=> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024) ["code"]=> NULL ["message"]=> string(17) "MDB2 Error: Array" ["userinfo"]=> string(224) "_doQuery: [Error message: Could not execute statement] [Last executed query: select PRIMARY_SHORT_COMPANY_NAME from wvb_company where company_perm_id #= 454] [Native code: 911] [Native message: ORA-00911: invalid character] Test script: --------------- select PRIMARY_SHORT_COMPANY_NAME from wvb_company where company_perm_id #= 454 Any wrong Sql statement Expected result: ---------------- MDB2 Error: ........... (some text here, not an array) Actual result: -------------- MDB2 Error: Array

Comments

 [2007-01-09 08:38 UTC] pcdinh at gmail dot com
There is a mismatch between the constructor: function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null) { $this->PEAR_Error('MDB2 Error: '.MDB2::errorMessage($code), $code, $mode, $level, $debuginfo); } and PEAR::raiseError The code to instantiate an object of MDB2_Error $err =& PEAR::raiseError(NULL, $code, $mode, $options, $userinfo, 'MDB2_Error', false); that will make a call to PEAR::raiseError that includes these logic: if ($skipmsg) { $a = &new $ec($code, $mode, $options, $userinfo); return $a; } else { $a = &new $ec($message, $code, $mode, $options, $userinfo); return $a; } because $skipmsg is set to be true so $a = &new $ec($code, $mode, $options, $userinfo); will be called But in fact $code is null and MDB2::errorMessage($code) will return an array. In MDb2::raiseError() the initial parameter $userinfo in fact can be acted as $message but it is ignored
 [2007-01-09 08:59 UTC] pcdinh at gmail dot com
File oci8.php, line 637 $result = @OCIParse($connection, $query); if (!$result) { $err = $this->raiseError(null, null, null, 'Could not create statement', __FUNCTION__); return $err; } Code has been assigned as null.
 [2007-02-03 23:55 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. -- Cause: missing error code 911