bool NameValueTableWrapper::advanceFullPos(FullPos& fp) { bool reset = fp.getResetFlag(); NameValueTable::Iterator iter = reset ? NameValueTable::Iterator(m_tab) : NameValueTable::Iterator(m_tab, fp.m_pos); if (reset) { fp.setResetFlag(false); } else { if (!iter.valid()) { return false; } iter.next(); } fp.m_pos = iter.toInteger(); if (!iter.valid()) return false; // To conform to PHP behavior, we need to set the internal // cursor to point to the next element. iter.next(); m_pos = iter.toInteger(); return true; }
bool GlobalsArray::AdvanceMArrayIter(ArrayData* ad, MArrayIter& fp) { auto a = asGlobals(ad); bool reset = fp.getResetFlag(); NameValueTable::Iterator iter = reset ? NameValueTable::Iterator(a->m_tab) : NameValueTable::Iterator(a->m_tab, fp.m_pos); if (reset) { fp.setResetFlag(false); } else { if (!iter.valid()) { return false; } iter.next(); } fp.m_pos = iter.toInteger(); if (!iter.valid()) return false; // To conform to PHP behavior, we need to set the internal // cursor to point to the next element. iter.next(); a->m_pos = iter.toInteger(); return true; }