summaryrefslogtreecommitdiff
path: root/zend
diff options
context:
space:
mode:
Diffstat (limited to 'zend')
-rw-r--r--zend/value.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/zend/value.cpp b/zend/value.cpp
index da42f30..f596669 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -1490,8 +1490,18 @@ bool Value::contains(const char *key, int size) const
// is marked as private/protected (cast necessary for php 5.3)
if (zend_check_property_access(zend_objects_get_address(_val TSRMLS_CC), const_cast<char *>(key), size TSRMLS_CC) == FAILURE) return false;
- // check if the property is set inside the hashtable of the object
- return zend_hash_find(Z_OBJPROP_P(_val), key, size+1, (void **)&result) != FAILURE;
+ // check if the 'has_property' method is available for this object
+ auto *has_property = Z_OBJ_HT_P(_val)->has_property;
+
+ // leap out if no 'has_property' function is not set (which should normally not occur)
+ if (!has_property) return false;
+
+ // the property must be a zval, turn the key into a value
+ Value property(key, size);
+
+ // call the has_property() method (0 means: check whether property exists and is not NULL,
+ // this is not really what we want, but the closest to the possible values of that parameter)
+ return has_property(_val, property._val, 0, nullptr TSRMLS_CC);
}
else
{