diff --git a/hphp/runtime/base/array/array_iterator.cpp b/hphp/runtime/base/array/array_iterator.cpp index bf895fc5d..60d614367 100644 --- a/hphp/runtime/base/array/array_iterator.cpp +++ b/hphp/runtime/base/array/array_iterator.cpp @@ -274,21 +274,21 @@ Variant ArrayIter::second() { if (UNLIKELY(m_version != mp->getVersion())) { throw_collection_modified(); } - return mp->iter_value(m_pos); + return tvAsCVarRef(mp->iter_value(m_pos)); } case Collection::StableMapType: { c_StableMap* smp = getStableMap(); if (UNLIKELY(m_version != smp->getVersion())) { throw_collection_modified(); } - return smp->iter_value(m_pos); + return tvAsCVarRef(smp->iter_value(m_pos)); } case Collection::SetType: { c_Set* st = getSet(); if (UNLIKELY(m_version != st->getVersion())) { throw_collection_modified(); } - return st->iter_value(m_pos); + return tvAsCVarRef(st->iter_value(m_pos)); } case Collection::PairType: { return tvAsCVarRef(getPair()->at(m_pos)); @@ -315,7 +315,7 @@ void ArrayIter::secondHelper(Variant& v) { if (UNLIKELY(m_version != mp->getVersion())) { throw_collection_modified(); } - v = mp->iter_value(m_pos); + v = tvAsCVarRef(mp->iter_value(m_pos)); break; } case Collection::StableMapType: { @@ -323,7 +323,7 @@ void ArrayIter::secondHelper(Variant& v) { if (UNLIKELY(m_version != smp->getVersion())) { throw_collection_modified(); } - v = smp->iter_value(m_pos); + v = tvAsCVarRef(smp->iter_value(m_pos)); break; } case Collection::SetType: { @@ -331,7 +331,7 @@ void ArrayIter::secondHelper(Variant& v) { if (UNLIKELY(m_version != st->getVersion())) { throw_collection_modified(); } - v = st->iter_value(m_pos); + v = tvAsCVarRef(st->iter_value(m_pos)); break; } case Collection::PairType: { diff --git a/hphp/runtime/ext/ext_collections.cpp b/hphp/runtime/ext/ext_collections.cpp index cbb10e3da..0e4feac9a 100644 --- a/hphp/runtime/ext/ext_collections.cpp +++ b/hphp/runtime/ext/ext_collections.cpp @@ -1915,10 +1915,10 @@ Variant c_Map::iter_key(ssize_t pos) const { return (int64_t)p->ikey; } -Variant c_Map::iter_value(ssize_t pos) const { +TypedValue* c_Map::iter_value(ssize_t pos) const { assert(pos); Bucket* p = reinterpret_cast(pos); - return tvAsCVarRef(&p->data); + return &p->data; } void c_Map::throwBadKeyType() { @@ -2105,7 +2105,7 @@ Variant c_MapIterator::t_current() { if (!m_pos) { throw_iterator_not_valid(); } - return mp->iter_value(m_pos); + return tvAsCVarRef(mp->iter_value(m_pos)); } Variant c_MapIterator::t_key() { @@ -3011,10 +3011,10 @@ Variant c_StableMap::iter_key(ssize_t pos) const { return (int64_t)p->ikey; } -Variant c_StableMap::iter_value(ssize_t pos) const { +TypedValue* c_StableMap::iter_value(ssize_t pos) const { assert(pos); Bucket* p = reinterpret_cast(pos); - return tvAsCVarRef(&p->data); + return &p->data; } struct StableMapKeyAccessor { @@ -3386,7 +3386,7 @@ Variant c_StableMapIterator::t_current() { if (!m_pos) { throw_iterator_not_valid(); } - return smp->iter_value(m_pos); + return tvAsCVarRef(smp->iter_value(m_pos)); } Variant c_StableMapIterator::t_key() { @@ -4060,10 +4060,10 @@ ssize_t c_Set::iter_prev(ssize_t pos) const { return 0; } -Variant c_Set::iter_value(ssize_t pos) const { +const TypedValue* c_Set::iter_value(ssize_t pos) const { assert(pos); Bucket* p = reinterpret_cast(pos); - return tvAsCVarRef(&p->data); + return &p->data; } void c_Set::throwBadValueType() { @@ -4185,7 +4185,7 @@ Variant c_SetIterator::t_current() { if (!m_pos) { throw_iterator_not_valid(); } - return st->iter_value(m_pos); + return tvAsCVarRef(st->iter_value(m_pos)); } Variant c_SetIterator::t_key() { diff --git a/hphp/runtime/ext/ext_collections.h b/hphp/runtime/ext/ext_collections.h index d7c5f7394..dfbf8920d 100644 --- a/hphp/runtime/ext/ext_collections.h +++ b/hphp/runtime/ext/ext_collections.h @@ -472,7 +472,7 @@ class c_Map : public ExtObjectDataFlags