- Fixed bug #35543 (php crash when calling non existing method of a class
that extends PDO). (Tony)
- Fixed bug #35539 (typo in error message for ErrorException). (Tony)
+- Fixed bug #35509 (string constant as array key has different behavior inside
+ object). (Dmitry)
- Fixed bug #35508 (PDO fails when unknown fetch mode specified). (Tony)
- Fixed bug #35499 (strtotime() does not handle whitespace around the date
string). (Ilia)
--- /dev/null
+--TEST--
+Bug #35509 (string constant as array key has different behavior inside object)
+--FILE--
+<?php
+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);
+?>
+--EXPECT--
+Array
+(
+ [01] => value
+)
+Array
+(
+ [01] => value
+)
*element = new_val;
switch (const_value.type) {
- case IS_STRING: {
- long lval;
- double dval;
-
- if (is_numeric_string(const_value.value.str.val, const_value.value.str.len, &lval, &dval, 0) == IS_LONG) {
- zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_LONG, NULL, 0, lval);
- } else {
- zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_STRING, const_value.value.str.val, const_value.value.str.len+1, 0);
- }
+ case IS_STRING:
+ zend_symtable_update_current_key(p->value.ht, const_value.value.str.val, const_value.value.str.len+1);
break;
- }
case IS_BOOL:
case IS_LONG:
zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_LONG, NULL, 0, const_value.value.lval);
return zend_hash_exists(ht, arKey, nKeyLength);
}
+static inline int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength)
+{
+ HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx));
+ return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0);
+}
+
#endif /* ZEND_HASH_H */
/*