|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-07-06 16:48 UTC] nobody at somewhere dot de
Description:
------------
I don't know about any php-Interna
Somehow a PHP-Variable seems to have a Flag that means "Is a Reference". This Flag is not resetted under the conditions I show in the code below.
Cheers!
Reproduce code:
---------------
#---
global $ar;
$ar= array("[element of ar]");
var_dump($ar);
$ok= f();
$ok[0]= "[i DIDN'T set ar!]";
var_dump($ar);
$bug= & f();
$bug= f(); # bug! doesn't reset reference-flag
$bug[0]= "[i DIDN'T set ar!]";
var_dump($ar);
function & f() {
global $ar;
return $ar;
}
exit;
#---
Expected result:
----------------
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(15) "[element of ar]" }
Actual result:
--------------
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(18) "[i DIDN'T set ar!]" }
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 13:00:01 2025 UTC |
Output on PHP 5.1.0-dev (Jul 21 2005 08:29:50): array(1) { [0]=> string(15) "[element of ar]" } array(1) { [0]=> string(15) "[element of ar]" } array(1) { [0]=> string(18) "[i DIDN'T set ar!]" }