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  


 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!