|  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
 [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: Wed Dec 19 15:01:28 2018 UTC