|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-28 05:50 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 08:00:02 2026 UTC |
The infinite recursion bug in print_r still appears to be there as can be demonstrated by this little script: <?php $tmp = array(); $tmp2 = array(); $tmp3 = array(); $tmp[] =& $tmp2; $tmp[] =& $tmp3; $tmp2[] =& $tmp; $tmp2[] =& $tmp3; $tmp3[] =& $tmp; $tmp3[] =& $tmp2; print_r($tmp); ?> I have looked into the code and I believe the bug lies in zend_print_zval_r_ex(). if (++expr->value.ht->nApplyCount>1) { ZEND_PUTS(" *RECURSION*"); expr->value.ht->nApplyCount=0; return; } seems to be wrong. I believe it should read: if (++expr->value.ht->nApplyCount>1) { ZEND_PUTS(" *RECURSION*"); expr->value.ht->nApplyCount--; return; } and the same change should be made lower down for the objects. The current code spots the recursion because the counter is 1 and increased to 2, but then effectively hides that state from anything else by resetting the counter to 0.