php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33928 I can broke 'GLOBALS'
Submitted: 2005-07-30 10:16 UTC Modified: 2005-08-01 09:49 UTC
From: bolk at hitv dot ru Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.0.4 OS: Linux Fedora Core 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bolk at hitv dot ru
New email:
PHP Version: OS:

 

 [2005-07-30 10:16 UTC] bolk at hitv dot ru
Description:
------------
I can broke 'GLOBALS' array and 'GLOBALS' items doesn't equal 'GLOBALS' var.

Reproduce code:
---------------
<?
	$a = unserialize(serialize($GLOBALS));
	$a['GLOBALS'] = 2;
	$GLOBALS = $a;

	print_r($GLOBALS['GLOBALS']);
?>

Expected result:
----------------
Array
(
    [GLOBALS] => Array
 *RECURSION*

et cetera

Actual result:
--------------
2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-30 10:44 UTC] bolk at hitv dot ru
But this example prints full GLOBALS:

<?
 $a = array_merge(array(), $GLOBALS);
 $a['GLOBALS'] = 2;

 $GLOBALS = $a;
 print_r($GLOBALS['GLOBALS']);
?>

There is an inconsistency between the two behaviours
 [2005-07-30 15:12 UTC] sniper@php.net
I can also shoot myself in my leg but I don't do that since it would be stupid..

 [2005-07-30 20:38 UTC] bolk at hitv dot ru
new PHP motto: it isn't a bug 'coz no one needs it working right anyways
 [2005-08-01 09:49 UTC] tony2001@php.net
You can do any stupid thing you want, but this is not PHP problem.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 02:00:03 2025 UTC