php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29974 num_rows crashes Apache (recurrence)
Submitted: 2004-09-03 19:40 UTC Modified: 2004-09-23 01:00 UTC
Votes:10
Avg. Score:4.5 ± 0.7
Reproduced:10 of 10 (100.0%)
Same Version:8 (80.0%)
Same OS:6 (60.0%)
From: david dot powers at dial dot pipex dot com Assigned:
Status: No Feedback Package: MySQLi related
PHP Version: 5.0.1 OS: Windows XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-09-03 19:40 UTC] david dot powers at dial dot pipex dot com
Description:
------------
Bug #28205 reported fixed in PHP 5.RC-3 appears to have resurfaced.

Use of $result->num_rows causes Apache to crash. Use of mysqli_num_rows() works without problem.

Environment:

Windows XP Pro
Apache 1.3.31
PHP 5.0.1
MySQL 4.1.4-gamma

extension=php_mbstring.dll
extension=php_mysqli.dll
extension=php_mysql.dll

Reproduce code:
---------------
$db = new mysqli($hostname, $username, $password, 'db_name');

$sql = 'SELECT * FROM wordlist';
$result = $db->query($sql);

$total = $result->num_rows;
echo "<h1>Total words: $total</h1>";
while ($row = $result->fetch_assoc()) {
  echo $row['word'].'<br />';
  }

Expected result:
----------------
I expect it not to crash.

Actual result:
--------------
Error report:

szAppName: Apache.exe  szAppVer: 0.0.0.0
szModName: php_mysql.dll szModVer: 5.0.1.1
offset: 000011fe

Code works perfectly if $total = $result->num_rows; is commented out.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-15 09:30 UTC] georg@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip


 [2004-09-20 01:31 UTC] splash2 at splashtech dot net
I also had this issue on php 5.0.1 final release... I downloaded the latest (at this time) snapshot located at http://snaps.php.net/win32/php5.0-win32-200409191630.zip.

The issue is resolved in that version. :)
 [2004-09-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-02-16 16:09 UTC] grikdotnet at aim dot com
I have a crash (segfault) when accessing the num_rows field after $result->close() is called.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 17 16:05:45 2022 UTC