|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9863 "global $var" incompatibility between PHP 3 & 4
Submitted: 2001-03-20 06:27 UTC Modified: 2001-03-20 06:40 UTC
From: hartmut at six dot de Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: hartmut at six dot de
New email:
PHP Version: OS:


 [2001-03-20 06:27 UTC] hartmut at six dot de
consider the following code snippet:

function foo() {
  global $bar;


echo $bar;

in PHP 3 calling foo() will create a global variable $bar
if it doesn't exist

in PHP 4 there will be no $bar after calling foo

i think PHP 4 should behave like PHP 3 here not only due
to compatibility reasons but also due to the "least supprise" rule


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-20 06:40 UTC]
can't reproduce anymore, please ignore
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Tue Oct 23 14:01:26 2018 UTC