|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-11-29 22:22 UTC] bugs-php-net at schirmeier dot com
[2004-11-29 22:39 UTC] bugs-php-net at schirmeier dot com
[2004-11-29 23:17 UTC] derick@php.net
[2005-01-18 04:06 UTC] philip@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
Description: ------------ compact() does not "see" superglobals like $_GET/$_POST/etc. when called within a function (documentation says: "Any strings that are not set will simply be skipped."). Tested on PHP versions 4.3.2, 4.3.9 (both Apache module and cli), 5.0.0, 5.0.1 (cli), 5.0.2, php5.1-dev-cli. Reproduce code: --------------- <?php function foo() { var_dump(compact('_GET', '_POST', '_SESSION', '_ENV', '_COOKIE', '_SERVER')); } var_dump(compact('_GET', '_POST', '_SESSION', '_ENV', '_COOKIE', '_SERVER')); echo "\n------------------------\n"; foo(); ?> Expected result: ---------------- A dump of an array with indexes '_GET', '_POST' etc. pointing to the contents of the respective superglobals, then a dashed line, then the same dump again. Actual result: -------------- The expected dump, the dashed line, and a:0:{}.