|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-30 14:50 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
Description: ------------ Whenever a function (global or class method) returns a reference to an array element which is not set, the value of that element is set to null. Reproduce code: --------------- $data = array(); function &get_data($key) { global $data; return $data[$key]; } print_r($data); $result = &get_data('TEST'); echo $result; print_r($data); Expected result: ---------------- The expected result would be that the value of the unset element would not be set and the following warning would be produced: Undefined index: TEST in ... Actual result: -------------- Array ( ) Array ( [TEST] => )