php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49223 Inconsistency using get_defined_constants(true)
Submitted: 2009-08-11 10:43 UTC Modified: 2009-08-17 21:29 UTC
From: carlos dot ballesteros at softonic dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.1-dev OS: win32 only
Private report: No CVE-ID: None
 [2009-08-11 10:43 UTC] carlos dot ballesteros at softonic dot com
Description:
------------
Before PHP 5.3, get_defined_constants with a parameter returned the core constants in a key called "internal". In PHP5.3 in linux it's returning them as "Core" key. But in windows it's returned as key "mhash". It's pretty weird.
It's similar to this bug: http://bugs.php.net/bug.php?id=47549
But at least in windows "mhash" key is wrong. And about linux, if the key changed from 'internal' to 'Core', I think it should, at least, be specified in the documentation.

http://es2.php.net/get_defined_constants

Reproduce code:
---------------
print_r(get_defined_constants(true));

Expected result:
----------------
Array
(
    [internal] => Array
        (
            [E_ERROR] => 1
            [E_RECOVERABLE_ERROR] => 4096
...

Actual result:
--------------
Linux:
-bash-3.2# php -r"print_r(get_defined_constants(true));" | more
Array
(
    [Core] => Array
        (
            [E_ERROR] => 1
            [E_RECOVERABLE_ERROR] => 4096
...
-bash-3.2# php -v
PHP 5.3.0 (cli) (built: Jun 30 2009 21:37:54)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

Windows:
C:\>php -r"print_r(get_defined_constants(true));" | more
Array
(
    [mhash] => Array
        (
            [E_ERROR] => 1
            [E_RECOVERABLE_ERROR] => 4096
...
C:\>php -v
PHP 5.3.0 (cli) (built: Jun 29 2009 21:55:01)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-11 11:29 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

'Core' is correct. Dunno about windows, might be fixed now. Try the snapshot.
 [2009-08-11 12:59 UTC] carlos dot ballesteros at softonic dot com
It's not working even in the lastest snapshot.

C:\dev\php53>php -v
PHP 5.3.1-dev (cli) (built: Aug 11 2009 10:52:16)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

C:\dev\php53>php -r"print_r(get_defined_constants(true));" | more
Array
(
    [mhash] => Array
        (
            [E_ERROR] => 1
...
 [2009-08-11 19:00 UTC] jani@php.net
Seems to be windows only issue.
 [2009-08-17 21:28 UTC] svn@php.net
Automatic comment from SVN on behalf of garretts
Revision: http://svn.php.net/viewvc/?view=revision&revision=287429
Log: - Fix for bug #49223 Inconsistency using get_defined_constants(true)
 [2009-08-17 21:29 UTC] garretts@php.net
This bug has been fixed in SVN.

The internal module mhash was improperly registered
 [2009-08-18 14:38 UTC] svn@php.net
Automatic comment from SVN on behalf of garretts
Revision: http://svn.php.net/viewvc/?view=revision&revision=287455
Log: added missing NEWS entry for bug #49223
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC