php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40311 Superglobals appearing as empty within functions
Submitted: 2007-02-01 23:52 UTC Modified: 2007-02-02 09:24 UTC
From: tretton at gmail dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 6CVS-2007-02-01 (snap) OS: WinXP SP2
Private report: No CVE-ID: None
 [2007-02-01 23:52 UTC] tretton at gmail dot com
Description:
------------
empty()/isset() doesn't work (returns opposite of expected) on superglobals when used inside functions.

Reproduce code:
---------------
<?php

// view script with: test.php?foo=bar

function test()
{
    if (!empty($_GET))
    {
        print_r($_GET);
    }
}

test();

?>

Expected result:
----------------
When run with something populating $_GET, I expect to see a proper printout from the print_r().

Actual result:
--------------
Nothing.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-02 08:42 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Make sure you actually have _GET variables.
 [2007-02-02 09:24 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 12:01:30 2024 UTC