php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35857 Crash using mysqli_stmt_fetch
Submitted: 2005-12-31 02:09 UTC Modified: 2006-01-24 13:28 UTC
From: auroraeosrose at gmail dot com Assigned: andrey (profile)
Status: Not a bug Package: MySQLi related
PHP Version: 5CVS-2005-12-31 (snap) OS: WinXPSP2
Private report: No CVE-ID: None
 [2005-12-31 02:09 UTC] auroraeosrose at gmail dot com
Description:
------------
Using mysqli_stmt_fetch or $stmt->fetch crashes apache/php

Broken with both mysql 5.0 and 4.1 

Reproduce code:
---------------
$mysqli = mysqli_connect("localhost", "root", "password", "db");

$mysqli->query("CREATE TABLE IF NOT EXISTS temp (id INT NOT NULL)");

$mysqli->query("INSERT INTO temp (id) VALUES
(1),(2),(3),(4)");


$stmt = $mysqli->prepare("SELECT id FROM temp");

$stmt->execute();

$stmt->bind_result($id);

$stmt->fetch();
var_dump($id);

$stmt->close();


$mysqli->query("DROP TABLE temp");
$mysqli->close();

Expected result:
----------------
1

Actual result:
--------------
Apache/php go boom - I'd send a backtrace but until I get nice "I'm on windows and don't do C" directions that's not going to happen

I have the annoying windows dump files if they're even useful

trying the same thing procedural style does the same thing - through commenting out trial and error the actual crash occurs on the $stmt->fetch() line

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-31 02:10 UTC] sniper@php.net
Please try using this CVS snapshot:

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


 [2005-12-31 03:25 UTC] auroraeosrose at gmail dot com
still happens - "Apache HTTP Server has encountered a problem and needs to close.  We are sorry for the inconvenience."

phpinfo says->
Build Date 	Dec 31 2005 00:19:15

don't think I can get any newer than that :)
 [2005-12-31 03:38 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2005-12-31 04:20 UTC] judas dot iscariote at gmail dot com
not reproducible in Linux amd64

$php mysqli.php
int(1)

php -v
PHP 5.1.2RC2-dev (cli) (built: Dec 29 2005 14:53:40)
 [2005-12-31 04:33 UTC] auroraeosrose at gmail dot com
I assume this is the backtrace you're looking for

>	libmySQL.dll!00bf79ab() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for libmySQL.dll]	
 	libmySQL.dll!00bf7aa3() 	
 	php_mysqli.dll!zif_mysqli_stmt_fetch(int ht=0, _zval_struct * return_value=0x04fea498, _zval_struct * * return_value_ptr=0x00000000, _zval_struct * this_ptr=0x04fea470, int return_value_used=0, void * * * tsrm_ls=0x00e67cb0)  Line 651	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data * execute_data=0x0419fb30, void * * * tsrm_ls=0x00e67cb0)  Line 192 + 0x35 bytes	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data * execute_data=0x0419fb30, void * * * tsrm_ls=0x00e67cb0)  Line 314 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array=0x0419ffa4, void * * * tsrm_ls=0x0419fc18)  Line 92 + 0xc bytes	C
 	ntdll.dll!_RtlFreeHeap@12()  + 0x130 bytes	
 	php5ts.dll!zend_ini_long(char * name=0x005d7980, unsigned int name_length=0, int orig=10)  Line 295 + 0xb bytes	C
 	msvcrt.dll!_strtol()  + 0x15 bytes	
 	04fe9250()
 [2005-12-31 08:33 UTC] tony2001@php.net
Doesn't look like PHP problem to me.
Assigned to MySQL guys.
 [2006-01-01 17:43 UTC] andrey@php.net
What's the version of the MySQL server?

 [2006-01-01 18:29 UTC] andrey@php.net
Can't reproduce using the following combinations
client - server
 4.1 - 5.0
 4.1 - 5.1
 5.0 - 4.1


 [2006-01-02 16:59 UTC] auroraeosrose at gmail dot com
I can reproduce it with two server versions

5.0.15-nt server
5.0.15 client 

4.1.16-nt server
5.0.15 client

so 5.0 -> 5.0 and 5.0 -> 4.1
 [2006-01-02 23:28 UTC] sniper@php.net
Are you sure you're using 5.0 client library? Did you recompile PHP mysqli extension linking it with 5.0 client library?
 [2006-01-03 02:23 UTC] auroraeosrose at gmail dot com
mysqli_get_client_info() gives me 5.0.15 client - I don't compile anything on windows, just put my php folder in the path variable
 [2006-01-10 17:48 UTC] georg@php.net
could you please try with php_mysqli.dll from 
http://dev.mysql.com/downloads/connector/php/ ? 
 [2006-01-10 21:20 UTC] auroraeosrose at gmail dot com
Very nifty - now it works properly

any hope for getting a note in the docs with links to those downloads for people who run into problems?
 [2006-01-13 11:53 UTC] vrana@php.net
Can you please try it with PHP 5.1.2?
 [2006-01-16 16:59 UTC] auroraeosrose at gmail dot com
Crashes with 5.1.2 as before and there isn't a dll for 5.1.2 on http://dev.mysql.com/downloads/connector/php/ and the 5.1.1 php_mysqli.dll from there doesn't work - which means mysqli_stmt_fetch is now broken for me again..
 [2006-01-24 13:28 UTC] georg@php.net
Can't repeat

Tested with PHP 5.1.2, MySQL 5.0.18 and mysqli extension (for PHP 5.1.2 from http://dev.mysql.com/downloads/connector/php)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC