#33966 [NEW]: wrong use of reflectionproperty causes a segfault

From: Date: Tue, 02 Aug 2005 12:24:01 +0000
Subject: #33966 [NEW]: wrong use of reflectionproperty causes a segfault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-82815@lists.php.net to get a copy of this message
From: derick@php.net Operating system: Linux (Debian) PHP version: 5CVS-2005-08-02 (dev) PHP Bug Type: Class/Object related Bug description: wrong use of reflectionproperty causes a segfault Description: ------------ When (ab)using the ReflectionProperty class' methods as static, it segfaults. Reproduce code: --------------- <?php class Base { public $x = 1; function __get($name) { if ( !ReflectionProperty::isPublic() ) { /* throw error */ } } } $b = new Base(); echo $b->foo; ?> Actual result: -------------- 0x083c2bdb in _property_check_flag (ht=0, return_value=0x878cfd4, return_value_ptr=0x0, this_ptr=0x878c714, return_value_used=1, mask=256) at /dat/dev/php/php-5.1dev/Zend/zend_reflection_api.c:3359 3359 RETURN_BOOL(ref->prop->flags & mask); (gdb) bt #0 0x083c2bdb in _property_check_flag (ht=0, return_value=0x878cfd4, return_value_ptr=0x0, this_ptr=0x878c714, return_value_used=1, mask=256) at /dat/dev/php/php-5.1dev/Zend/zend_reflection_api.c:3359 #1 0x083c2c24 in zif_reflection_property_isPublic (ht=0, return_value=0x878cfd4, return_value_ptr=0x0, this_ptr=0x878c714, return_value_used=1) at /dat/dev/php/php-5.1dev/Zend/zend_reflection_api.c:3366 #2 0x083c6309 in zend_do_fcall_common_helper_SPEC (execute_data=0xbfffd090) at zend_vm_execute.h:184 #3 0x083c692d in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0xbfffd090) at zend_vm_execute.h:299 #4 0x083c5f8a in execute (op_array=0x878dd34) at zend_vm_execute.h:87 #5 0x0838edc6 in zend_call_function (fci=0xbfffd260, fci_cache=0xbfffd220) at /dat/dev/php/php-5.1dev/Zend/zend_execute_API.c:871 #6 0x083aee9d in zend_call_method (object_pp=0xbfffd2f0, obj_ce=0x878c36c, fn_proxy=0x878c44c, function_name=0x85cfd54 "__get", function_name_len=5, retval_ptr_ptr=0xbfffd2e4, param_count=1, arg1=0x878cea4, arg2=0x0) at /dat/dev/php/php-5.1dev/Zend/zend_interfaces.c:87 #7 0x083b4e26 in zend_std_call_getter (object=0x878c714, member=0x878cea4) at /dat/dev/php/php-5.1dev/Zend/zend_object_handlers.c:72 #8 0x083b576e in zend_std_read_property (object=0x878c714, member=0x878b148, type=0) at /dat/dev/php/php-5.1dev/Zend/zend_object_handlers.c:305 #9 0x083ff3f9 in zend_fetch_property_address_read_helper_SPEC_CV_CONST ( type=0, execute_data=0xbfffd440) at zend_vm_execute.h:20491 #10 0x083ff510 in ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HANDLER ( execute_data=0xbfffd440) at zend_vm_execute.h:20513 #11 0x083c5f8a in execute (op_array=0x8786de4) at zend_vm_execute.h:87 #12 0x0839b2fb in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /dat/dev/php/php-5.1dev/Zend/zend.c:1087 #13 0x08350fc4 in php_execute_script (primary_file=0xbffff8b0) at /dat/dev/php/php-5.1dev/main/main.c:1672 #14 0x0841325c in main (argc=1, argv=0xbffff994) at /dat/dev/php/php-5.1dev/sapi/cli/php_cli.c:1039 (gdb) print *ref Cannot access memory at address 0x2a8fcc84 -- Edit bug report at http://bugs.php.net/?id=33966&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33966&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33966&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33966&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33966&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33966&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33966&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33966&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33966&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33966&r=support Expected behavior: http://bugs.php.net/fix.php?id=33966&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33966&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33966&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33966&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33966&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33966&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33966&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33966&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33966&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33966&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33966&r=mysqlcfg

« previous php.bugs (#82815) next »