#49298 [NEW]: mysqli_show_warnings isn't much use

From: Date: Wed, 19 Aug 2009 14:15:26 +0000
Subject: #49298 [NEW]: mysqli_show_warnings isn't much use
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141244@lists.php.net to get a copy of this message
From: marcus at synchromedia dot co dot uk Operating system: PHP version: 5.3.0 PHP Bug Type: MySQLi related Bug description: mysqli_show_warnings isn't much use Description: ------------ mysqli_get_warnings only ever returns a single warning, even if more than one is available. Though its name implies a plural response, it doesn't deliver one. Reproduce code: --------------- Do this in a mysql CLI: CREATE TABLE blah ( x varchar(100) NOT NULL, y varchar(100) NOT NULL, z varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO blah SET z = '1'; Query OK, 1 row affected, 2 warnings (0.00 sec) mysql> show warnings; +---------+------+----------------------------------------+ | Level | Code | Message | +---------+------+----------------------------------------+ | Warning | 1364 | Field 'x' doesn't have a default value | | Warning | 1364 | Field 'y' doesn't have a default value | +---------+------+----------------------------------------+ Now do the same insert from PHP then call mysqli_get_warnings() (approximate code): mysqli_query($db, "INSERT INTO blah SET z = '1'"); $a = mysqli_get_warnings($db); var_dump($a); Expected result: ---------------- I'd want something like this: array (2) { object(mysqli_warning)#4 (3) { ["message"]=> string(38) "Field 'x' doesn't have a default value" ["sqlstate"]=> string(5) "HY000" ["errno"]=> int(1364) }, object(mysqli_warning)#5 (3) { ["message"]=> string(38) "Field 'y' doesn't have a default value" ["sqlstate"]=> string(5) "HY000" ["errno"]=> int(1364) } } Actual result: -------------- object(mysqli_warning)#4 (3) { ["message"]=> string(38) "Field 'x' doesn't have a default value" ["sqlstate"]=> string(5) "HY000" ["errno"]=> int(1364) } -- Edit bug report at http://bugs.php.net/?id=49298&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49298&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49298&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49298&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49298&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49298&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49298&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49298&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49298&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49298&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49298&r=support Expected behavior: http://bugs.php.net/fix.php?id=49298&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49298&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49298&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49298&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49298&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49298&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49298&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49298&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49298&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49298&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49298&r=mysqlcfg

« previous php.bugs (#141244) next »