ID: 35509
Updated by: [EMAIL PROTECTED]
Reported By: bill dot finn at sellingsource dot com
-Status: Assigned
+Status: Closed
Bug Type: Arrays related
Operating System: Gentoo 2.6.9
PHP Version: 6CVS-2005-12-01 (CVS)
Assigned To: dmitry
New Comment:
Fixed in CVS HEAD and PHP_5_1.
Previous Comments:
------------------------------------------------------------------------
[2005-12-01 21:08:57] [EMAIL PROTECTED]
Dmitry, please take a look at it.
------------------------------------------------------------------------
[2005-12-01 20:02:51] bill dot finn at sellingsource dot com
Description:
------------
When using a constant of '01' as an array key inside of a class, it
converts the key to the integer 1. Outside of a class, it leaves it as
'01'.
Reproduce code:
---------------
class mytest
{
const classConstant = '01';
private $classArray = array( mytest::classConstant => 'value' );
public function __construct()
{
print_r($this->classArray);
}
}
$classtest = new mytest();
define( "normalConstant", '01' );
$normalArray = array( normalConstant => 'value' );
print_r($normalArray);
Expected result:
----------------
Array
(
[01] => value
)
Array
(
[01] => value
)
Actual result:
--------------
Array
(
[1] => value
)
Array
(
[01] => value
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35509&edit=1