From:             rockyroad29 at free dot fr
Operating system: linux
PHP version:      5.2CVS-2009-06-21 (snap)
PHP Bug Type:     Arrays related
Bug description:  get_defined_constants() ignores categorize parameter

Description:
------------
  get_defined_constants(FALSE)

returns the same categorized array as

  get_defined_constants(TRUE)

----
Hmmm, I just realized that 
  get_defined_constants()

returns the one-dimensional array I expected.

Anyway that's still a bug.



Reproduce code:
---------------
<?php
echo 'php version: ', phpversion(), "\n";
echo 'Testing the function: get_defined_constants([ bool $categorize  ] )'
, "\n";

$constants_T = get_defined_constants(TRUE);
$categs = array_keys($constants_T);
echo "First category: $categs[0]\n";

$constants_F = get_defined_constants(FALSE);
$names = array_keys($constants_F);

$n = count(array_diff($constants_T, $constants_F));
if ($n) {
  echo "$n differences found when changing the categorize parameter",
"\n";
  echo "THE BUG IS PROBABLY ABSENT\n";
  echo "First constant name: $names[0]\n";  
} else {
  echo "no difference found when changing the categorize parameter",
"\n";
  echo "A constant name is expected here, I get a category:
'$names[0]'\n";  
  echo "THE BUG IS PRESENT\n";
}

Expected result:
----------------
$ php constants.php
php version: xxxx
Testing the function: get_defined_constants([ bool $categorize  ] )
First category: internal
xxx differences found when changing the categorize parameter
THE BUG IS PROBABLY ABSENT
First constant name: E_ERROR


Actual result:
--------------
I tested two versions, on Ubuntu "Jaunty":

$ uname -a
Linux claddagh 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC
2009 i686 GNU/Linux

$ /usr/bin/php constants.php
php version: 5.2.6-3ubuntu4.1
Testing the function: get_defined_constants([ bool $categorize  ] )
First category: internal
no difference found when changing the categorize parameter
A constant name is expected here, I get a category: 'internal'
THE BUG IS PRESENT

$ /usr/local/bin/php constants.php
php version: 5.2.11-dev
Testing the function: get_defined_constants([ bool $categorize  ] )
First category: internal
no difference found when changing the categorize parameter
A constant name is expected here, I get a category: 'internal'
THE BUG IS PRESENT

$ /usr/local/bin/php -version
PHP 5.2.11-dev (cli) (built: Jun 21 2009 20:21:29) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies



-- 
Edit bug report at http://bugs.php.net/?id=48629&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48629&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48629&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48629&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48629&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48629&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48629&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48629&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48629&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48629&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48629&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48629&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48629&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48629&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48629&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48629&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48629&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48629&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48629&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48629&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48629&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48629&r=mysqlcfg

Reply via email to