ID: 40204 Updated by: [EMAIL PROTECTED] Reported By: frode at coretrek dot com -Status: Open +Status: Analyzed Bug Type: Documentation problem Operating System: Irrelevant -PHP Version: Irrelevant +PHP Version: 5.2 New Comment:
This is complicated issue and _not_ recommended. The engine still has problem working with complex arrays with references to it self and leaks tons of memory while doing so. The example itself works as of 5.1 but still leaks and _can_ result in unexpected behavior. Previous Comments: ------------------------------------------------------------------------ [2007-01-23 08:38:14] frode at coretrek dot com Description: ------------ Exmaple 21-3 "References with complex arrays" as available on http://www.php.net/manual/en/language.references.whatdo.php is not correct, at least not for PHP version 5.2.0. The example claims to "not work as expected". But it does work as expected (and contrary to the documented results). Also, even if the example did "not work as expected", there is no explanation for why it is not supposed to work, other than stating that complex arrays "sometimes" (?!?) are copied. Reproduce code: --------------- <?php // taken directly from Example 21-3 $top = array( 'A' => array(), 'B' => array( 'B_b' => array(), ), ); $top['A']['parent'] = &$top; $top['B']['parent'] = &$top; $top['B']['B_b']['data'] = 'test'; print_r($top['A']['parent']['B']['B_b']); // array() ?> Expected result: ---------------- According to the documentation: array() Actual result: -------------- Array ( [data] => test ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40204&edit=1
