#43934 [NEW]: uncaught exception for wrong parameter type in mysql_fetch_object

From: Date: Fri, 25 Jan 2008 11:43:06 +0000
Subject: #43934 [NEW]: uncaught exception for wrong parameter type in mysql_fetch_object
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121529@lists.php.net to get a copy of this message
From: josmessa at uk dot ibm dot com Operating system: Windows XP PHP version: 5.2CVS-2008-01-25 (snap) PHP Bug Type: MySQL related Bug description: uncaught exception for wrong parameter type in mysql_fetch_object Description: ------------ If an argument that is not an array or null is passed as the $params (also called $ctor_params in source code) argument in mysql_fetch_object then the below uncaught exception is returned instead of a normal warning. The reproduced code below is similar to that of a test case from 5.3, although by the time that what I have described above was tested no more rows were in $res so bool(false) was being returned and so this problem may also be in 5.3 Reproduce code: --------------- <?php //select database and table... $res = mysql_query('SELECT col1 FROM test'); class mysql_fetch_object_test { public $a = null; public $b = null; public function __construct($a, $b) { $this->a = $a; $this->b = $b; } public function toString() { var_dump($this); } } var_dump(mysql_fetch_object($res, 'mysql_fetch_object_test', 'not array')); ?> Actual result: -------------- Fatal error: Uncaught exception 'Exception' with message 'Parameter ctor_params must be an array' in ...\mysql_fetch_object.php:25 Stack trace: #0 ...\mysql_fetch_object.php(25): mysql_fetch_object(Resource id #5, 'mysql_fetch_obj...', 'not array') #1 {main} thrown in ...\mysql_fetch_object.php on line 25 -- Edit bug report at http://bugs.php.net/?id=43934&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43934&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43934&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43934&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43934&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43934&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43934&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43934&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43934&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43934&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43934&r=support Expected behavior: http://bugs.php.net/fix.php?id=43934&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43934&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43934&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43934&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43934&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43934&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43934&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43934&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43934&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43934&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43934&r=mysqlcfg

« previous php.bugs (#121529) next »