cvs: ZendEngine2 / zend_hash.c /tests bug45742.phpt
"Dmitry Stogov" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.zend |
|---|---|
| Message-ID | <cvsdmitry1218109500@cvsserver> |
dmitry Thu Aug 7 11:45:00 2008 UTC
Added files:
/ZendEngine2/tests bug45742.phpt
Modified files:
/ZendEngine2 zend_hash.c
Log:
Fixed bug #45742 (Wrong class array inpretetion using constant indexes)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_hash.c?r1=1.157&r2=1.158&diff_format=u
Index: ZendEngine2/zend_hash.c
diff -u ZendEngine2/zend_hash.c:1.157 ZendEngine2/zend_hash.c:1.158
--- ZendEngine2/zend_hash.c:1.157 Fri Aug 1 14:21:45 2008
+++ ZendEngine2/zend_hash.c Thu Aug 7 11:45:00 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_hash.c,v 1.157 2008/08/01 14:21:45 dmitry Exp $ */
+/* $Id: zend_hash.c,v 1.158 2008/08/07 11:45:00 dmitry Exp $ */
#include "zend.h"
#include "zend_operators.h"
@@ -1674,14 +1674,22 @@
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 @@
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;
}
}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug45742.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug45742.phpt
+++ ZendEngine2/tests/bug45742.phpt
--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)
}
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php