diff options
author | andot <mabingyao@gmail.com> | 2014-07-11 16:59:58 +0800 |
---|---|---|
committer | andot <mabingyao@gmail.com> | 2014-07-11 16:59:58 +0800 |
commit | bf88eac6d32771891c8335e56f0d3fde6d53edd8 (patch) | |
tree | 09d5e79e4bc77570770d14e2c50dc4b287198d76 /zend/value.cpp | |
parent | 28578382589dab25ea5fbd35b7754687706abc07 (diff) |
Fixed a bug of HashIterator
The old implementation of HashIterator can't support `"\0"` prefix key.
I think the array and the object is different. Maybe the user didn't
want to get the private property of an object. but in an array, `"\0"`
prefix key doesn't mean private key. so we should return `"\0"` prefix
key when it is an array.
Diffstat (limited to 'zend/value.cpp')
-rw-r--r-- | zend/value.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/zend/value.cpp b/zend/value.cpp index 9a1a5db..352e90d 100644 --- a/zend/value.cpp +++ b/zend/value.cpp @@ -1626,7 +1626,7 @@ std::map<std::string,Php::Value> Value::mapValue() const ValueIterator Value::createIterator(bool begin) const { // check type - if (isArray()) return ValueIterator(new HashIterator(Z_ARRVAL_P(_val), begin)); + if (isArray()) return ValueIterator(new HashIterator(Z_ARRVAL_P(_val), begin, true)); // get access to the hast table if (isObject()) @@ -1647,7 +1647,7 @@ ValueIterator Value::createIterator(bool begin) const else { // construct a regular iterator - return ValueIterator(new HashIterator(Z_OBJ_HT_P(_val)->get_properties(_val TSRMLS_CC), begin)); + return ValueIterator(new HashIterator(Z_OBJPROP_P(_val), begin)); } } |