|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-06-22 00:03 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 13 08:00:02 2025 UTC |
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