ID:               48629
 Updated by:       fel...@php.net
 Reported By:      rockyroad29 at free dot fr
-Status:           Open
+Status:           Closed
 Bug Type:         Arrays related
 Operating System: linux
 PHP Version:      5.2CVS-2009-06-21 (snap)
 New Comment:

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.




Previous Comments:
------------------------------------------------------------------------

[2009-06-21 19:38:50] rockyroad29 at free dot fr

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 this bug report at http://bugs.php.net/?id=48629&edit=1

Reply via email to