diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-03-30 15:30:33 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-03-30 15:30:33 +0200 |
commit | 41cc89280ec8c21638fe6d4931ef145b103b5caa (patch) | |
tree | 05bb109ace2f0cd8c8fd9f82cca666b29fd46999 | |
parent | 7a928e2b19bddf152fd838469cc50805d4132401 (diff) |
add PHPCPP_EXPORT macros to a number of << operators to prevent undefined symbol errors, Value::contains() now also works with __isset()
-rw-r--r-- | include/hashmember.h | 4 | ||||
-rw-r--r-- | include/value.h | 2 | ||||
-rw-r--r-- | zend/value.cpp | 14 |
3 files changed, 15 insertions, 5 deletions
diff --git a/include/hashmember.h b/include/hashmember.h index 12ee385..378ee90 100644 --- a/include/hashmember.h +++ b/include/hashmember.h @@ -611,8 +611,8 @@ private: * @param value * @return ostream */ -std::ostream &operator<<(std::ostream &stream, const HashMember<int> &value); -std::ostream &operator<<(std::ostream &stream, const HashMember<std::string> &value); +PHPCPP_EXPORT std::ostream &operator<<(std::ostream &stream, const HashMember<int> &value); +PHPCPP_EXPORT std::ostream &operator<<(std::ostream &stream, const HashMember<std::string> &value); /** diff --git a/include/value.h b/include/value.h index 40327cd..29b64af 100644 --- a/include/value.h +++ b/include/value.h @@ -1204,7 +1204,7 @@ protected: * @param value * @return ostream */ -std::ostream &operator<<(std::ostream &stream, const Value &value); +PHPCPP_EXPORT std::ostream &operator<<(std::ostream &stream, const Value &value); /** * Custom +=, -=, *=, /=, &= operators, to update integral types with a Php::Value diff --git a/zend/value.cpp b/zend/value.cpp index 0d1f840..f98ac10 100644 --- a/zend/value.cpp +++ b/zend/value.cpp @@ -1489,8 +1489,18 @@ bool Value::contains(const char *key, int size) const // retrieve the object pointer and check whether the property we are trying to retrieve is marked as private/protected if (zend_check_property_access(zend_objects_get_address(_val TSRMLS_CC), 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 { |