php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34491 mysqli_fetch_array - Segmentation fault
Submitted: 2005-09-13 13:59 UTC Modified: 2005-09-13 16:06 UTC
From: cd_gk at gmx dot de Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5.0.5 OS: Red Hat Enterprise Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
32 - 8 = ?
Subscribe to this entry?

 
 [2005-09-13 13:59 UTC] cd_gk at gmx dot de
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 ()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-13 14:07 UTC] tony2001@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

Works perfectly here.
 [2005-09-13 16:06 UTC] cd_gk at gmx dot de
ok. it works :-)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC