From: marcing at smlw dot pl
Operating system: WinXP SP2
PHP version: 5.1.0
PHP Bug Type: MySQLi related
Bug description: using mysqli with MySQL 5.0.16 causes Apache crash
Description:
------------
Env:
Windows XP SP2
Apache 2.0.48 / 2.0.55 (not relevant)
MySQL 5.0.16
PHP 5.0.3 /5.1 (not relevant)
MySQLi
Important: Problem is related to MySQLi when using MySQL version 5 only,
it doesn't occur with version 4.
Reproduce code:
---------------
<?php
$db = new mysqli(...);
if($stmt = $db->prepare('SELECT SUM(visitors) FROM core_stats')) {
$stmt->execute();
$stmt->bind_result($total);
$stmt->close();
}
?>
The problem occurs when using SUM() in query, endless loop seems to start
when $stmt->bind_result($total) is invoked and as a result Apache
crashes.
Database reproduction code:
----------------------------------
CREATE TABLE `core_stats` (
`id` int(10) unsigned NOT NULL auto_increment,
`day_of_week` int(1) unsigned NOT NULL default '0',
`day_of_month` int(2) unsigned NOT NULL default '0',
`m` int(2) unsigned NOT NULL default '0',
`y` int(4) unsigned NOT NULL default '0',
`visitors` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `core_stats` VALUES (1, 2, 5, 7, 2005, 1);
INSERT INTO `core_stats` VALUES (2, 3, 6, 7, 2005, 6);
INSERT INTO `core_stats` VALUES (3, 4, 7, 7, 2005, 7);
INSERT INTO `core_stats` VALUES (4, 5, 8, 7, 2005, 1);
Expected result:
----------------
It should work as it worked on MySQL 4.
Actual result:
--------------
Internal Server Error
--
Edit bug report at http://bugs.php.net/?id=35428&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35428&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=35428&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=35428&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35428&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35428&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35428&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35428&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35428&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35428&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35428&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35428&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35428&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35428&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35428&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35428&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35428&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35428&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35428&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35428&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35428&r=mysqlcfg