php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60778 mysqli object crashes when given to var_dump
Submitted: 2012-01-17 14:03 UTC Modified: 2013-02-18 00:35 UTC
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: yoram dot b at zend dot com Assigned: andrey (profile)
Status: No Feedback Package: MySQLi related
PHP Version: 5.4.0RC5 OS: Linux debian
Private report: No CVE-ID: None
 [2012-01-17 14:03 UTC] yoram dot b at zend dot com
Description:
------------
This happens when mysqli uses libmysql (not mysqlnd). tested with php 5.40RC5 and PHP 5.3.3.

php -r '$a = new mysqli; var_dump($a);'
gives a lot or warnings  "PHP Warning:  var_dump(): Property access is not allowed yet in Command line code on line 1"
and then crashes with segmentation fault.
same with apache module.

backtrace:
#0  0xb639f45b in mysql_stat () from /usr/lib/libmysqlclient.so.16
#1  0xb65fd80b in link_stat_read (obj=0xb7d44ca0, retval=0xbfffee80)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli_prop.c:275
#2  0xb65ecb14 in mysqli_read_property (object=0xb7d43f10, member=0xbfffeeec, type=3, key=0x0)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli.c:341
#3  0xb65ed050 in mysqli_object_get_debug_info (object=0xb7d43f10, is_temp=0xbfffefd0)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli.c:470
#4  0x082fb926 in php_var_dump (struc=0xb7d2a0cc, level=1) at /php-5.4.0RC5/ext/standard/var.c:129
#5  0x082fbd22 in zif_var_dump (ht=1, return_value=0xb7d43ef4, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /php-5.4.0RC5/ext/standard/var.c:183
#6  0x083eba4d in zend_do_fcall_common_helper_SPEC (execute_data=0xb7d2a030) at /php-5.4.0RC5/Zend/zend_vm_execute.h:642
#7  0x083f2163 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xb7d2a030) at /php-5.4.0RC5/Zend/zend_vm_execute.h:2215
#8  0x083ea5b7 in execute (op_array=0xb7d44308) at /php-5.4.0RC5/Zend/zend_vm_execute.h:410
#9  0x083a804c in zend_eval_stringl (str=0xbffffa06 "$a = new mysqli; var_dump($a);", str_len=30, retval_ptr=0x0, 
    string_name=0x8755734 "Command line code") at /php-5.4.0RC5/Zend/zend_execute_API.c:1199
#10 0x083a8256 in zend_eval_stringl_ex (str=0xbffffa06 "$a = new mysqli; var_dump($a);", str_len=30, retval_ptr=0x0, 
    string_name=0x8755734 "Command line code", handle_exceptions=1) at /php-5.4.0RC5/Zend/zend_execute_API.c:1242
#11 0x083a82ec in zend_eval_string_ex (str=0xbffffa06 "$a = new mysqli; var_dump($a);", retval_ptr=0x0, 
    string_name=0x8755734 "Command line code", handle_exceptions=1) at /php-5.4.0RC5/Zend/zend_execute_API.c:1253
#12 0x084c430a in do_cli (argc=3, argv=0xbffff834) at /php-5.4.0RC5/sapi/cli/php_cli.c:1023
#13 0x084c50cc in main (argc=3, argv=0xbffff834) at /php-5.4.0RC5/sapi/cli/php_cli.c:1356
(gdb) frame 2
#2  0xb65ecb14 in mysqli_read_property (object=0xb7d43f10, member=0xbfffeeec, type=3, key=0x0)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli.c:341
341                     ret = hnd->read_func(obj, &retval TSRMLS_CC);




Test script:
---------------
$a = new mysqli; var_dump($a);

Actual result:
--------------
backtrace:
#0  0xb639f45b in mysql_stat () from /usr/lib/libmysqlclient.so.16
#1  0xb65fd80b in link_stat_read (obj=0xb7d44ca0, retval=0xbfffee80)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli_prop.c:275
#2  0xb65ecb14 in mysqli_read_property (object=0xb7d43f10, member=0xbfffeeec, type=3, key=0x0)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli.c:341
#3  0xb65ed050 in mysqli_object_get_debug_info (object=0xb7d43f10, is_temp=0xbfffefd0)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli.c:470
#4  0x082fb926 in php_var_dump (struc=0xb7d2a0cc, level=1) at /php-5.4.0RC5/ext/standard/var.c:129
#5  0x082fbd22 in zif_var_dump (ht=1, return_value=0xb7d43ef4, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /php-5.4.0RC5/ext/standard/var.c:183
#6  0x083eba4d in zend_do_fcall_common_helper_SPEC (execute_data=0xb7d2a030) at /php-5.4.0RC5/Zend/zend_vm_execute.h:642
#7  0x083f2163 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xb7d2a030) at /php-5.4.0RC5/Zend/zend_vm_execute.h:2215
#8  0x083ea5b7 in execute (op_array=0xb7d44308) at /php-5.4.0RC5/Zend/zend_vm_execute.h:410
#9  0x083a804c in zend_eval_stringl (str=0xbffffa06 "$a = new mysqli; var_dump($a);", str_len=30, retval_ptr=0x0, 
    string_name=0x8755734 "Command line code") at /php-5.4.0RC5/Zend/zend_execute_API.c:1199
#10 0x083a8256 in zend_eval_stringl_ex (str=0xbffffa06 "$a = new mysqli; var_dump($a);", str_len=30, retval_ptr=0x0, 
    string_name=0x8755734 "Command line code", handle_exceptions=1) at /php-5.4.0RC5/Zend/zend_execute_API.c:1242
#11 0x083a82ec in zend_eval_string_ex (str=0xbffffa06 "$a = new mysqli; var_dump($a);", retval_ptr=0x0, 
    string_name=0x8755734 "Command line code", handle_exceptions=1) at /php-5.4.0RC5/Zend/zend_execute_API.c:1253
#12 0x084c430a in do_cli (argc=3, argv=0xbffff834) at /php-5.4.0RC5/sapi/cli/php_cli.c:1023
#13 0x084c50cc in main (argc=3, argv=0xbffff834) at /php-5.4.0RC5/sapi/cli/php_cli.c:1356
(gdb) frame 2
#2  0xb65ecb14 in mysqli_read_property (object=0xb7d43f10, member=0xbfffeeec, type=3, key=0x0)
    at /home/yoram/ZendModules/patched-php-src-5.4.0RC5/php-5.4.0RC5/ext/mysqli/mysqli.c:341
341                     ret = hnd->read_func(obj, &retval TSRMLS_CC);




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-22 19:43 UTC] rasmus@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: andrey
 [2012-09-25 13:05 UTC] vitex at hippy dot cz
Dear developers please fix it. 
While debbuging with xdebug it produce hunderts of error messages
and is not easy to develop php code.

Thanks!
 [2012-09-25 13:40 UTC] andrey@php.net
-Status: Assigned +Status: Feedback
 [2012-09-25 13:40 UTC] andrey@php.net
Can you try with recent 5.4 or 5.3 release and paste the result?
Thank you!
 [2012-10-02 08:57 UTC] yoram dot b at zend dot com
-Status: Feedback +Status: Assigned
 [2012-10-02 08:57 UTC] yoram dot b at zend dot com
I will try that, but it will take time, since my default build is with mysqlnd, so I will have to build PHP specially for that.
 [2012-10-02 09:15 UTC] yoram dot b at zend dot com
The crash seems to be fixed.
the warning "Property access is not allowed yet" still exists. mysqlnd does not give such warning.
 [2012-10-02 09:19 UTC] andrey@php.net
Will wait for your input. Thanks much!
 [2012-10-02 09:19 UTC] andrey@php.net
-Status: Assigned +Status: Feedback
 [2013-02-18 00:35 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 [2013-07-04 08:41 UTC] marc at mittagqi dot com
Just had this problem with PHP Version 5.4.16 on Linux infong 2.4 (1&1 managed 
server). Please reopen this bug.
 [2013-07-04 08:43 UTC] marc at mittagqi dot com
addition to my previous comment: I experienced the bug as stated here:

 [2012-10-02 09:15 UTC] yoram dot b at zend dot com
The crash seems to be fixed.
the warning "Property access is not allowed yet" still exists. mysqlnd does not 
give such warning.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 13:01:29 2024 UTC