helly Tue Mar 20 20:21:39 2007 UTC
Added files:
/php-src/ext/spl/tests bug40872.phpt
Modified files:
/php-src/ext/spl spl_array.c
Log:
- Fix Bug #40872 (inconsistency in offsetSet, offsetExists treatment of
string enclosed integers)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.121&r2=1.122&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.121 php-src/ext/spl/spl_array.c:1.122
--- php-src/ext/spl/spl_array.c:1.121 Thu Feb 8 20:13:49 2007
+++ php-src/ext/spl/spl_array.c Tue Mar 20 20:21:39 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.121 2007/02/08 20:13:49 helly Exp $ */
+/* $Id: spl_array.c,v 1.122 2007/03/20 20:21:39 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -460,7 +460,7 @@
{
spl_array_object *intern =
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
long index;
- zval *rv;
+ zval *rv, **tmp;
if (check_inherited && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
@@ -480,9 +480,7 @@
case IS_STRING:
case IS_UNICODE:
if (check_empty) {
- zval **tmp;
- HashTable *ht = spl_array_get_hash_table(intern, 0
TSRMLS_CC);
- if (zend_u_hash_find(ht, Z_TYPE_P(offset),
Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, (void **) &tmp) != FAILURE &&
zend_is_true(*tmp)) {
+ if (zend_symtable_find(spl_array_get_hash_table(intern,
0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) !=
FAILURE && zend_is_true(*tmp)) {
return 1;
}
return 0;
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug40872.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug40872.phpt
+++ php-src/ext/spl/tests/bug40872.phpt
--TEST--
Bug #40872 (inconsistency in offsetSet, offsetExists treatment of string
enclosed integers)
--FILE--
<?php
class Project {
public $id;
function __construct($id) {
$this->id = $id;
}
}
class ProjectsList extends ArrayIterator {
public function add(Project $item) {
$this->offsetSet($item->id, $item);
}
}
$projects = new ProjectsList();
$projects->add(new Project('1'));
$projects->add(new Project(2));
var_dump($projects->offsetExists(1));
var_dump($projects->offsetExists('2'));
?>
===DONE===
--EXPECT--
bool(true)
bool(true)
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php