mirror of
https://github.com/php/php-src.git
synced 2025-08-17 22:48:57 +02:00
Fixed bug #45742 (Wrong class array inpretetion using constant indexes)
This commit is contained in:
parent
333ae016f0
commit
c1e5b1345d
2 changed files with 44 additions and 4 deletions
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)
|
||||||
|
}
|
|
@ -1196,15 +1196,23 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||||
if (found) {
|
if (found) {
|
||||||
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
if (p->nKeyLength) {
|
||||||
|
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||||
} else {
|
} else {
|
||||||
zend_hash_index_del(ht, p->h);
|
zend_hash_index_del(ht, p->h);
|
||||||
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
if (p->nKeyLength) {
|
||||||
|
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||||
} else {
|
} else {
|
||||||
zend_hash_index_del(ht, p->h);
|
zend_hash_index_del(ht, p->h);
|
||||||
|
}
|
||||||
return FAILURE;
|
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) {
|
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
if (p->nKeyLength) {
|
||||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||||
|
} else {
|
||||||
|
zend_hash_index_del(ht, p->h);
|
||||||
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
if (p->nKeyLength) {
|
||||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||||
|
} else {
|
||||||
|
zend_hash_index_del(ht, p->h);
|
||||||
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue