mirror of
https://github.com/php/php-src.git
synced 2024-09-23 02:47:26 +00:00
Fixed bug #45742 (Wrong class array inpretetion using constant indexes)
This commit is contained in:
parent
a51e5ebaeb
commit
a3d8718b9a
24
Zend/tests/bug45742.phpt
Normal file
24
Zend/tests/bug45742.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #45742 Wrong class array inpretetion using constant indexes
|
||||
--FILE--
|
||||
<?php
|
||||
class Constants {
|
||||
// Needs to be equal
|
||||
const A = 1;
|
||||
const B = 1;
|
||||
}
|
||||
|
||||
class ArrayProperty {
|
||||
public static $array = array(
|
||||
Constants::A => 23,
|
||||
Constants::B => 42,
|
||||
);
|
||||
}
|
||||
|
||||
var_dump( ArrayProperty::$array );
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[1]=>
|
||||
int(23)
|
||||
}
|
@ -1674,14 +1674,22 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr s
|
||||
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||
break;
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
if (p->nKeyLength) {
|
||||
zend_u_hash_del(ht, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
||||
break;
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
if (p->nKeyLength) {
|
||||
zend_u_hash_del(ht, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
@ -1715,14 +1723,22 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr s
|
||||
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||
break;
|
||||
} else {
|
||||
zend_u_hash_del(ht, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
|
||||
if (p->nKeyLength) {
|
||||
zend_u_hash_del(ht, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
||||
break;
|
||||
} else {
|
||||
zend_u_hash_del(ht, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
|
||||
if (p->nKeyLength) {
|
||||
zend_u_hash_del(ht, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user