From: camka at email dot ee
Operating system: Windows XP
PHP version: 5.1.4
PHP Bug Type: MySQLi related
Bug description: exception not thrown in multi_query's
Description:
------------
When trying to execute multiple queryes with multi_query method, when
first query is ok, and second one is broken, the exception is not thrown
when iterating second function's resultset of the multiquery. Only ::error
is set.
Reproduce code:
---------------
<?php
mysqli_report( MYSQLI_REPORT_STRICT | MYSQLI_REPORT_ERROR );
try
{
$m = new mysqli('**', '**', '**', '**');
$m->multi_query('select 1; bug;');
do {
/* store first result set */
if ($result = $m->store_result())
{
while ($row = $result->fetch_row())
{
printf("%s\n", $row[0]);
}
$result->close();
}
/* print divider */
if ($m->more_results()) {
printf("-----------------\n");
}
}
while ($m->next_result());
echo $m->error;
}
catch (mysqli_sql_exception $e)
{
var_dump($e);
}
Expected result:
----------------
1 ----------------- You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use
near 'bug' at line 1
Actual result:
--------------
1 -----------------
object(mysqli_sql_exception)[2]
protected 'message' => 'You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near 'bug; bug' at line 1' (length=154)
private 'string' => '' (length=0)
protected 'code' => 1064
protected 'file' => '**' (length=35)
protected 'line' => 7
private 'trace' =>
array
0 =>
array
'file' => '**' (length=35)
'line' => 7
'function' => 'multi_query' (length=11)
'class' => 'mysqli' (length=6)
'type' => '->' (length=2)
'args' =>
array
0 => 'bug; bug;' (length=9)
protected 'sqlstate' => '42000' (length=5)
--
Edit bug report at http://bugs.php.net/?id=37674&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37674&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=37674&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37674&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37674&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37674&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37674&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37674&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37674&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37674&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37674&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37674&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37674&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37674&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37674&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37674&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37674&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37674&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37674&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37674&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37674&r=mysqlcfg