|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull Requests
Pull requests: HistoryAllCommentsChangesGit/SVN commits              [2016-03-19 19:31 UTC] vvvaagn at gmail dot com
  [2016-03-20 11:56 UTC] laruence@php.net
  [2016-03-20 11:56 UTC] laruence@php.net
 
-Status: Open
+Status: Closed
  [2016-07-20 11:32 UTC] davey@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 03:00:01 2025 UTC | 
Description: ------------ If a destructor instantiates new objects, objects->object_buckets might be reallocated in zend_objects_store_put, making obj_ptr dangle and sometimes crashing PHP. Test script: --------------- <?php class constructs_in_destructor { public function __destruct() { //We are now in zend_objects_store_call_destructors //This causes a realloc in zend_objects_store_put for ($i = 0; $i < 10000; ++$i) { $GLOBALS["a$i"] = new stdClass; } //Returns to zend_objects_store_call_destructors, to access freed memory. } } gc_disable(); $a = new constructs_in_destructor; //Create cycle so destructors are ran only in zend_objects_store_call_destructors $a->a = $a; // Create some objects so zend_objects_store_call_destructors has something // to do after constructs_in_destructor is destroyed. for ($i = 0; $i < 200; ++$i) { $GLOBALS["b$i"] = new stdClass; } Expected result: ---------------- No crash Actual result: -------------- #0 0x00000000008528ef in zend_objects_store_call_destructors (objects=0x1145ff0 <executor_globals+816>) at /var/lib/yaourt/yaourt-tmp-jasu/abs-php/src/php-7.0.4/Zend/zend_objects_API.c:54 #1 0x00000000007e9a57 in shutdown_destructors () at /var/lib/yaourt/yaourt-tmp-jasu/abs-php/src/php-7.0.4/Zend/zend_execute_API.c:242 #2 0x00000000008028c1 in zend_call_destructors () at /var/lib/yaourt/yaourt-tmp-jasu/abs-php/src/php-7.0.4/Zend/zend.c:952 #3 0x000000000076b5fe in php_request_shutdown (dummy=0x0) at /var/lib/yaourt/yaourt-tmp-jasu/abs-php/src/php-7.0.4/main/main.c:1774 #4 0x00000000008cc813 in do_cli (argc=2, argv=0x114b9f0) at /var/lib/yaourt/yaourt-tmp-jasu/abs-php/src/php-7.0.4/sapi/cli/php_cli.c:1142 #5 0x00000000008cd099 in main (argc=2, argv=0x114b9f0) at /var/lib/yaourt/yaourt-tmp-jasu/abs-php/src/php-7.0.4/sapi/cli/php_cli.c:1345