summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-06-21 19:15:27 +0000
committerMarcus Boerger <helly@php.net>2004-06-21 19:15:27 +0000
commitdc66fb1f10518b1c4712fd4d253ab3fb61428080 (patch)
tree2aab0a86f1af5ba2a5db5ca6cc47b63453450e22 /ext
parent7fcfa8865e97a6c8141532187428d9dd9d1217e5 (diff)
downloadphp-git-dc66fb1f10518b1c4712fd4d253ab3fb61428080.tar.gz
Fixed bug #28822: ArrayObject::offsetExists() works inverted
Diffstat (limited to 'ext')
-rwxr-xr-xext/spl/spl_array.c2
-rwxr-xr-xext/spl/tests/bug28822.phpt16
2 files changed, 17 insertions, 1 deletions
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 28a4870366..901bd35552 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -337,7 +337,7 @@ SPL_METHOD(Array, offsetExists)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) {
return;
}
- RETURN_BOOL(spl_array_has_dimension(getThis(), index, 1 TSRMLS_CC) == SUCCESS);
+ RETURN_BOOL(spl_array_has_dimension(getThis(), index, 1 TSRMLS_CC));
} /* }}} */
/* {{{ proto bool ArrayObject::offsetGet(mixed $index)
diff --git a/ext/spl/tests/bug28822.phpt b/ext/spl/tests/bug28822.phpt
new file mode 100755
index 0000000000..c3da4607f5
--- /dev/null
+++ b/ext/spl/tests/bug28822.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #28822: ArrayObject::offsetExists() works inverted
+--FILE--
+<?php
+
+$array = new ArrayObject();
+$array->offsetSet('key', 'value');
+var_dump($array->offsetExists('key'));
+var_dump($array->offsetExists('nokey'));
+
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(false)
+===DONE===