mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fixed bug #45742 (Wrong class array inpretetion using constant indexes)
This commit is contained in:
parent
333ae016f0
commit
c1e5b1345d
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)
|
||||
}
|
@ -1197,14 +1197,22 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||
break;
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
if (p->nKeyLength) {
|
||||
zend_hash_del(ht, p->arKey, 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_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
@ -1234,14 +1242,22 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||
break;
|
||||
} else {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
if (p->nKeyLength) {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
||||
break;
|
||||
} else {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
if (p->nKeyLength) {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user