|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-06 01:52 UTC] tony2001@php.net
[2006-01-09 10:30 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 13:00:01 2025 UTC |
Description: ------------ In the code below method StructAddNodePointer gets a part (branch) of the array (in the example $bar->dxml_struct_arr) and fills it. It works in PHP 5.0.5 but doesn't work in PHP 5.1.1. It seems in PHP 5.1.1 passing &$dxml_struct_arr by reference doesn't work. Or may be it doesn't work here: $pointer_tree_doc_value = &$bar->StructAddNodePointer('doc', $bar->dxml_struct_arr); Reproduce code: --------------- class foo { function StructAddNode($tag, &$dxml_struct_arr, $attribs = array()) { $dxml_struct_arr[] = array( 'tag' => $tag, 'value' => null #array() ); $index= (sizeof($dxml_struct_arr)-1); return $index; } function StructAddNodePointer($tag, &$dxml_struct_arr, $attribs = array()) { $index = $this->StructAddNode($tag, $dxml_struct_arr, $attribs); return $dxml_struct_arr[$index]['value']; } } $bar = new foo(); $bar->dxml_struct_arr = array(); $pointer_tree_doc_value = &$bar->StructAddNodePointer('doc', $bar->dxml_struct_arr); $pointer_tree_head_value = &$bar->StructAddNodePointer('HEAD', $pointer_tree_doc_value); print_r($bar->dxml_struct_arr); Expected result: ---------------- Array ( [0] => Array ( [tag] => doc [value] => Array ( [0] => Array ( [tag] => HEAD [value] => ) ) ) ) Actual result: -------------- Array ( [0] => Array ( [tag] => doc [value] => ) )