|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-12-24 05:46 UTC] thedinosaurmail at gmail dot com
[2019-12-24 06:49 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2019-12-24 06:49 UTC] requinix@php.net
[2019-12-24 13:57 UTC] ssigwart at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ When you assign a variable to a superglobal ($_SESSION, $_GET, etc) by reference within a function, the variable is reset to null once you exit the function. Test script: --------------- $_SESSION['var'] = 1; function func1() { global $ref; global $nonRef; $ref = &$_SESSION['var']; $nonRef = $_SESSION['var']; } func1(); var_dump($_SESSION['var']); var_dump($ref); var_dump($nonRef); Expected result: ---------------- int(1) int(1) int(1) Actual result: -------------- int(1) NULL int(1)