|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-11-26 15:48 UTC] manuel-php at mausz dot at
Description: ------------ After updating to 7.1.12 and 7.0.26 we noticed an increased rate in crashes across all our webservers. The crashes are somehow triggered by "NextGEN Gallery" and reverting https://github.com/php/php-src/commit/bc59289b7a25219ea2179554dc26c88e533250a5 + https://github.com/php/php-src/commit/98eee90734c4fabf3f3a3d4168576cb6b25ad9b1 fixed it. Backtrace: #0 zend_mm_alloc_small (bin_num=<optimized out>, size=<optimized out>, heap=0x7fe70d600040) at /tmp/php-7.0.26/fpm/Zend/zend_alloc.c:1318 #1 zend_mm_alloc_heap (size=<optimized out>, heap=0x7fe70d600040) at /tmp/php-7.0.26/fpm/Zend/zend_alloc.c:1389 #2 _emalloc (size=<optimized out>) at /tmp/php-7.0.26/fpm/Zend/zend_alloc.c:2477 #3 0x00000000007bf579 in zend_hash_real_init_ex (packed=<optimized out>, ht=0x7fe70b0ccd20) at /tmp/php-7.0.26/fpm/Zend/zend_hash.c:135 #4 zend_hash_check_init (packed=<optimized out>, ht=0x7fe70b0ccd20) at /tmp/php-7.0.26/fpm/Zend/zend_hash.c:163 #5 _zend_hash_index_add_or_update_i (flag=10, pData=0x10cb840 <executor_globals>, h=0, ht=0x7fe70b0ccd20) at /tmp/php-7.0.26/fpm/Zend/zend_hash.c:729 #6 _zend_hash_index_add_new (ht=ht@entry=0x7fe70b0ccd20, h=0, pData=pData@entry=0x10cb840 <executor_globals>) at /tmp/php-7.0.26/fpm/Zend/zend_hash.c:853 #7 0x000000000081c8f8 in zend_fetch_dimension_address_inner (type=1, dim_type=16, dim=<optimized out>, ht=<optimized out>) at /tmp/php-7.0.26/fpm/Zend/zend_execute.c:1572 #8 ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER () at /tmp/php-7.0.26/fpm/Zend/zend_vm_execute.h:20864 #9 0x00000000007eddf8 in execute_ex (ex=<optimized out>) at /tmp/php-7.0.26/fpm/Zend/zend_vm_execute.h:414 #10 0x00000000007a3285 in zend_call_function (fci=fci@entry=0x7ffe0e1640e0, fci_cache=0x7fe70d6d6da0, fci_cache@entry=0x0) at /tmp/php-7.0.26/fpm/Zend/zend_execute_API.c:867 #11 0x00000000007a3698 in call_user_function_ex (function_table=<optimized out>, object=object@entry=0x0, function_name=<optimized out>, retval_ptr=retval_ptr@entry=0x7ffe0e164170, param_count=<optimized out>, params=<optimized out>, no_separation=no_separation@entry=1, symbol_table=symbol_table@entry=0x0) at /tmp/php-7.0.26/fpm/Zend/zend_execute_API.c:675 #12 0x00000000007a36d0 in call_user_function (function_table=<optimized out>, object=object@entry=0x0, function_name=<optimized out>, retval_ptr=retval_ptr@entry=0x7ffe0e164170, param_count=<optimized out>, params=<optimized out>) at /tmp/php-7.0.26/fpm/Zend/zend_execute_API.c:657 #13 0x00000000006ab7b2 in user_shutdown_function_call (zv=<optimized out>) at /tmp/php-7.0.26/fpm/ext/standard/basic_functions.c:4934 #14 0x00000000007c1f6d in zend_hash_apply (ht=0x7fe70d79a3b8, apply_func=apply_func@entry=0x6ab6dd <user_shutdown_function_call>) at /tmp/php-7.0.26/fpm/Zend/zend_hash.c:1537 #15 0x00000000006ae9ad in php_call_shutdown_functions () at /tmp/php-7.0.26/fpm/ext/standard/basic_functions.c:5018 #16 0x0000000000754595 in php_request_shutdown (dummy=dummy@entry=0x0) at /tmp/php-7.0.26/fpm/main/main.c:1804 #17 0x000000000048e07a in main (argc=<optimized out>, argv=<optimized out>) at /tmp/php-7.0.26/fpm/sapi/fpm/fpm/fpm_main.c:2066 PHP backtrace from core dump: (gdb) dump_bt executor_globals.current_execute_data [0x7fe70d618740] WP_Hook->apply_filters("", array(1)[0x7fe70d6187b0]) /path/to/wp-includes/class-wp-hook.php:271 [0x7fe70d618680] WP_Hook->do_action(array(1)[0x7fe70d6186e0]) /path/to/wp-includes/class-wp-hook.php:310 [0x7fe70d618330] do_action("shutdown") /path/to/wp-includes/plugin.php:453 [0x7fe70d6182b0] shutdown_action_hook() /path/to/wp-includes/load.php:679 [0x7ffe0e164040] ??? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
So I spend some time tracing the crash and trying to copy the minimal object model. The script I've come up with has different btacktrace and only crashes about 1 out of 5 runs, but it's related as PHP with both commits reverted doesn't crash anymore. Script: ------- <?php class A { var $_stdObject; function initialize($properties = FALSE) { $this->_stdObject = $properties ? (object) $properties : new stdClass(); parent::initialize(); } function &__get($property) { if (isset($this->_stdObject->{$property})) { $retval =& $this->_stdObject->{$property}; return $retval; } else { return NULL; } } function &__set($property, $value) { return $this->_stdObject->{$property} = $value; } function __isset($property_name) { return isset($this->_stdObject->{$property_name}); } } class B extends A { function initialize($properties = array()) { parent::initialize($properties); } function &__get($property) { if (isset($this->settings) && isset($this->settings[$property])) { $retval =& $this->settings[$property]; return $retval; } else { return parent::__get($property); } } } $b = new B(); $b->settings = [ "foo" => "bar", "name" => "abc" ]; var_dump($b->name); var_dump($b->settings);This bug should be re-opened and the fix also applied to the 7.0 branch... Patch for 7.0.26 looks like this: --- Zend/zend_object_handlers.c.org 2017-11-21 12:57:10.000000000 +0100 +++ Zend/zend_object_handlers.c 2017-11-30 14:42:29.154940011 +0100 @@ -602,8 +602,8 @@ zval_ptr_dtor(&tmp_object); goto exit; } else { - zval_ptr_dtor(&tmp_object); if (Z_STRVAL_P(member)[0] == '\0') { + zval_ptr_dtor(&tmp_object); if (Z_STRLEN_P(member) == 0) { zend_throw_error(NULL, "Cannot access empty property"); retval = &EG(uninitialized_zval); Thanks in advance