From:             
Operating system: Linux debian
PHP version:      5.4.0RC5
Package:          MySQLi related
Bug Type:         Bug
Bug description:mysqli object crashes when given to var_dump

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);




-- 
Edit bug report at https://bugs.php.net/bug.php?id=60778&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60778&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60778&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60778&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60778&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60778&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60778&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60778&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60778&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60778&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60778&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60778&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60778&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60778&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60778&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60778&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60778&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60778&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60778&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60778&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60778&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60778&r=mysqlcfg

Reply via email to