ID: 43934 Updated by: [EMAIL PROTECTED] Reported By: josmessa at uk dot ibm dot com -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Windows XP PHP Version: 5.2CVS-2008-01-25 (snap) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2008-03-07 19:53:17] [EMAIL PROTECTED] The comments on code justify such behavior: /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be * by mistake and the other way round is possible, too. The * single value is an array. Also we'd have to make that one * argument passed by reference. */ ------------------------------------------------------------------------ [2008-01-25 11:43:06] josmessa at uk dot ibm dot com 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 this bug report at http://bugs.php.net/?id=43934&edit=1