diff options
author | Dmitry Stogov <dmitry@zend.com> | 2012-03-21 16:51:24 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2012-03-21 16:51:24 +0400 |
commit | 09e367dbaffa1e8c5ba7b88e9997d9ddc1c6d0c0 (patch) | |
tree | 7d700c40e11d48767a4c4cc3ea093339a0e7a2ef | |
parent | a8cc0b05b45110ccf408ea9410447bf82b8826f2 (diff) | |
parent | 0f001703a8987960de041b216a023869ab439857 (diff) | |
download | php-git-09e367dbaffa1e8c5ba7b88e9997d9ddc1c6d0c0.tar.gz |
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | ext/spl/spl_observer.c | 4 | ||||
-rw-r--r-- | ext/spl/tests/bug61453.phpt | 19 |
3 files changed, 23 insertions, 2 deletions
@@ -98,6 +98,8 @@ PHP NEWS ReflectionMethod::invokeArgs()). (Laruence) - SPL: + . Fixed bug #61453 (SplObjectStorage does not identify objects correctly). + (Gustavo) . Fixed bug #61347 (inconsistent isset behavior of Arrayobject). (Laruence) - Standard: diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 5eaa8fd43f..4b8be82eee 100755 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -146,14 +146,14 @@ static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *thi return (char*)&Z_OBJVAL_P(obj); #else - char *hash = emalloc((hash_len+1)*sizeof(char)); + char *hash = emalloc(hash_len + 1); zend_object_value zvalue; memset(&zvalue, 0, sizeof(zend_object_value)); zvalue.handle = Z_OBJ_HANDLE_P(obj); zvalue.handlers = Z_OBJ_HT_P(obj); - strncpy(hash, (char *)&zvalue, hash_len); + memcpy(hash, (char *)&zvalue, hash_len); hash[hash_len] = 0; if (hash_len_ptr) { diff --git a/ext/spl/tests/bug61453.phpt b/ext/spl/tests/bug61453.phpt new file mode 100644 index 0000000000..e5b1387fd2 --- /dev/null +++ b/ext/spl/tests/bug61453.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #61453: SplObjectStorage does not identify objects correctly +--FILE-- +<?php +$limit = 1000; +$objects = new SplObjectStorage; +for($i = 0; $i < $limit; $i++){ + $object = new StdClass; + + if(isset($objects[$object])){ + die("this should never happen, but did after $i iteration"); + } + + $objects[$object] = 1; +} +?> +==DONE== +--EXPECT-- +==DONE== |