ID: 49194 Updated by: col...@php.net Reported By: gwy...@php.net -Status: Assigned +Status: Closed Bug Type: *General Issues Operating System: * PHP Version: 5.3, 6 (2009-08-07) Assigned To: colder New Comment:
This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Found another solution which do not imply an API break. Previous Comments: ------------------------------------------------------------------------ [2009-08-07 20:33:40] col...@php.net This is an inherent problem of the get_debug_info handler. For closures which should (I guess) remain constant across multiple var_dump calls, there is an easy solution of caching the HT. http://patches.colder.ch/php-src/zend_closures_recursion-5.3.patch?markup However, multiple mutable classes uses a custom debug_info handler with full control over the items, such as SPLDoublyLinkedList. The problem here seems to be impossible to fix without adapting the get_debug_info handler. Changing it from HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TSRMLS_DC); to HashTable **(*zend_object_get_debug_info_t)(zval *object, int *is_temp TSRMLS_DC); should be sufficient. ------------------------------------------------------------------------ [2009-08-07 18:44:09] gwy...@php.net Description: ------------ Calling var_dump() on a closure that references itself results in an infinite loop. Reproduce code: --------------- <?php $f = function () use (&$f) {}; var_dump($f); ?> Expected result: ---------------- object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> &object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=>RECURSION } } } } Actual result: -------------- object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> &object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> &object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> <repeats forever> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49194&edit=1