From: cd_gk at gmx dot de
Operating system: Red Hat Enterprise Linux
PHP version: 5.0.5
PHP Bug Type: MySQLi related
Bug description: mysqli_fetch_array - Segmentation fault
Description:
------------
AMD Opteron x86_64 GNU/Linux
Apache/1.3.33 (Unix) PHP/5.0.4 or PHP/5.0.5
call mysqli_fetch_array with an resulttype craches.
without resulttype works fine.
Reproduce code:
---------------
<?php
$link = mysqli_connect("localhost", "user", "password", "database");
$query = "SELECT * FROM table";
$result = mysqli_query($link, $query);
$row = mysqli_fetch_array($result, MYSQLI_BOTH); # failed
printf ("1. %s (%s)\n", $row[0], $row['name']);
#$row = mysqli_fetch_array($result, MYSQLI_NUM); # failed
#printf ("2. %s (%s)\n", $row[0], $row[0]);
#$row = mysqli_fetch_array($result, MYSQLI_ASSOC); # failed
#printf ("3. %s (%s)\n", $row[0], $row['name']);
#$row = mysqli_fetch_array($result); # ok
#printf ("4. %s (%s)\n", $row[0], $row[0]);
?>
Expected result:
----------------
A row like this:
1. 2 (Hello World)
Actual result:
--------------
##[MYSQL_BOTH]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182903832736 (LWP 26378)]
0x0000002a96234d15 in zend_object_store_get_object (zobject=0x0)
at /opt/build/_work/php-5.0.4/Zend/zend_objects_API.c:200
200 zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
#0 0x0000002a96234d15 in zend_object_store_get_object (zobject=0x0)
at /opt/build/_work/php-5.0.4/Zend/zend_objects_API.c:200
#1 0x0000002a96096b32 in php_mysqli_fetch_into_hash (ht=2,
return_value=0x6fa910, this_ptr=0x0, return_value_used=1,
override_flags=0, into_object=0)
at /opt/build/_work/php-5.0.4/ext/mysqli/mysqli.c:624
#2 0x0000002a960a3a3e in zif_mysqli_fetch_array (ht=2,
return_value=0x6fa910,
this_ptr=0x0, return_value_used=1)
at /opt/build/_work/php-5.0.4/ext/mysqli/mysqli_nonapi.c:193
#3 0x0000002a96247f3b in zend_do_fcall_common_helper (
execute_data=0x7fbfff5150, opline=0x6fcc50, op_array=0x725ce0)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:2727
#4 0x0000002a96248778 in zend_do_fcall_handler
(execute_data=0x7fbfff5150,
opline=0x6fcc50, op_array=0x725ce0)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:2859
#5 0x0000002a96243ff7 in execute (op_array=0x725ce0)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:1406
#6 0x0000002a96217a4a in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /opt/build/_work/php-5.0.4/Zend/zend.c:1069
#7 0x0000002a961c6c7e in php_execute_script (primary_file=0x7fbfff7720)
at /opt/build/_work/php-5.0.4/main/main.c:1632
#8 0x0000002a962514a8 in apache_php_module_main (r=0x5d1d90,
display_source_mode=0)
at /opt/build/_work/php-5.0.4/sapi/apache/sapi_apache.c:54
#9 0x0000002a96252394 in send_php (r=0x5d1d90, display_source_mode=0,
filename=0x5d3128
"/usr/local/apache/htdocs/htdocs/mysqli_test.php")
at /opt/build/_work/php-5.0.4/sapi/apache/mod_php5.c:622
#10 0x0000002a96252416 in send_parsed_php (r=0x5d1d90)
at /opt/build/_work/php-5.0.4/sapi/apache/mod_php5.c:637
---Type <return> to continue, or q <return> to quit---
#11 0x0000000000431d05 in ap_invoke_handler ()
#12 0x00000000004492a2 in process_request_internal ()
#13 0x00000000004492f7 in ap_process_request ()
#14 0x000000000043f8ce in child_main ()
#15 0x000000000043fa62 in make_child ()
#16 0x000000000043fbe3 in startup_children ()
#17 0x0000000000440310 in standalone_main ()
#18 0x0000000000440b0b in main ()
##[With MYSQL_NUM]##
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182903832736 (LWP 26481)]
0x0000002a96234d15 in zend_object_store_get_object (zobject=0x0)
at /opt/build/_work/php-5.0.4/Zend/zend_objects_API.c:200
200 zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
#0 0x0000002a96234d15 in zend_object_store_get_object (zobject=0x0)
at /opt/build/_work/php-5.0.4/Zend/zend_objects_API.c:200
#1 0x0000002a96096b32 in php_mysqli_fetch_into_hash (ht=2,
return_value=0x71b3a0, this_ptr=0x0, return_value_used=1,
override_flags=0, into_object=0)
at /opt/build/_work/php-5.0.4/ext/mysqli/mysqli.c:624
#2 0x0000002a960a3a3e in zif_mysqli_fetch_array (ht=2,
return_value=0x71b3a0,
this_ptr=0x0, return_value_used=1)
at /opt/build/_work/php-5.0.4/ext/mysqli/mysqli_nonapi.c:193
#3 0x0000002a96247f3b in zend_do_fcall_common_helper (
execute_data=0x7fbfff4160, opline=0x711500, op_array=0x70c400)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:2727#4
0x0000002a96248778 in zend_do_fcall_handler (execute_data=0x7fbfff4160,
opline=0x711500, op_array=0x70c400)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:2859#5
0x0000002a96243ff7 in execute (op_array=0x70c400)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:1406#6
0x0000002a96217a4a in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /opt/build/_work/php-5.0.4/Zend/zend.c:1069
#7 0x0000002a961c6c7e in php_execute_script (primary_file=0x7fbfff6730)
at /opt/build/_work/php-5.0.4/main/main.c:1632
#8 0x0000002a962514a8 in apache_php_module_main (r=0x5d1d90,
display_source_mode=0)
at /opt/build/_work/php-5.0.4/sapi/apache/sapi_apache.c:54
#9 0x0000002a96252394 in send_php (r=0x5d1d90, display_source_mode=0,
filename=0x5d3108 "/usr/local/apache/htdocs/htdocs/mysqli_test.php")
at /opt/build/_work/php-5.0.4/sapi/apache/mod_php5.c:622
#10 0x0000002a96252416 in send_parsed_php (r=0x5d1d90)
at /opt/build/_work/php-5.0.4/sapi/apache/mod_php5.c:637
---Type <return> to continue, or q <return> to quit---
#11 0x0000000000431d05 in ap_invoke_handler ()
#12 0x00000000004492a2 in process_request_internal ()
#13 0x00000000004492f7 in ap_process_request ()
#14 0x000000000043f8ce in child_main ()
#15 0x000000000043fa62 in make_child ()
#16 0x000000000043fbe3 in startup_children ()
#17 0x0000000000440310 in standalone_main ()
#18 0x0000000000440b0b in main ()
##[With MYSQLI_ASSOC]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182903832736 (LWP 26532)]
0x0000002a96234d15 in zend_object_store_get_object (zobject=0x0)
at /opt/build/_work/php-5.0.4/Zend/zend_objects_API.c:200
200 zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
#0 0x0000002a96234d15 in zend_object_store_get_object (zobject=0x0)
at /opt/build/_work/php-5.0.4/Zend/zend_objects_API.c:200
#1 0x0000002a96096b32 in php_mysqli_fetch_into_hash (ht=2,
return_value=0x71b3b0, this_ptr=0x0, return_value_used=1,
override_flags=0, into_object=0)
at /opt/build/_work/php-5.0.4/ext/mysqli/mysqli.c:624
#2 0x0000002a960a3a3e in zif_mysqli_fetch_array (ht=2,
return_value=0x71b3b0,
this_ptr=0x0, return_value_used=1)
at /opt/build/_work/php-5.0.4/ext/mysqli/mysqli_nonapi.c:193
#3 0x0000002a96247f3b in zend_do_fcall_common_helper (
execute_data=0x7fbfff68a0, opline=0x711510, op_array=0x70c410)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:2727#4
0x0000002a96248778 in zend_do_fcall_handler (execute_data=0x7fbfff68a0,
opline=0x711510, op_array=0x70c410)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:2859#5
0x0000002a96243ff7 in execute (op_array=0x70c410)
at /opt/build/_work/php-5.0.4/Zend/zend_execute.c:1406#6
0x0000002a96217a4a in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /opt/build/_work/php-5.0.4/Zend/zend.c:1069
#7 0x0000002a961c6c7e in php_execute_script (primary_file=0x7fbfff8e70)
at /opt/build/_work/php-5.0.4/main/main.c:1632
#8 0x0000002a962514a8 in apache_php_module_main (r=0x5d2640,
display_source_mode=0)
at /opt/build/_work/php-5.0.4/sapi/apache/sapi_apache.c:54
#9 0x0000002a96252394 in send_php (r=0x5d2640, display_source_mode=0,
filename=0x5d39b8 "/usr/local/apache/htdocs/htdocs/mysqli_test.php")
at /opt/build/_work/php-5.0.4/sapi/apache/mod_php5.c:622
#10 0x0000002a96252416 in send_parsed_php (r=0x5d2640)
at /opt/build/_work/php-5.0.4/sapi/apache/mod_php5.c:637
--Type <return> to continue, or q <return> to quit---
#11 0x0000000000431d05 in ap_invoke_handler ()
#12 0x00000000004492a2 in process_request_internal ()
#13 0x00000000004492f7 in ap_process_request ()
#14 0x000000000043f8ce in child_main ()
#15 0x000000000043fa62 in make_child ()
#16 0x000000000043fbe3 in startup_children ()
#17 0x0000000000440310 in standalone_main ()
#18 0x0000000000440b0b in main ()
--
Edit bug report at http://bugs.php.net/?id=34491&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34491&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34491&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34491&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34491&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34491&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34491&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34491&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34491&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34491&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34491&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34491&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34491&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34491&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34491&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34491&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34491&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34491&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34491&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34491&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34491&r=mysqlcfg