summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zend/value.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/zend/value.cpp b/zend/value.cpp
index 963f05b..a728dcc 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -1455,8 +1455,10 @@ void Value::iterate(const std::function<void(const Php::Value &,const Php::Value
*/
bool Value::contains(int index) const
{
+ // if we're an object implementing ArrayAccess it makes sense for this method to work as well, so we call offsetExists
+ if (isObject() && instanceOf("ArrayAccess")) return call("offsetExists", index).boolValue();
// must be an array
- if (!isArray()) return false;
+ else if (!isArray()) return false;
// unused variable
zval **result;