void VariableSerializer::writeOverflow(void* ptr, bool isObject /* = false */) { bool wasRef = m_referenced; setReferenced(false); switch (m_type) { case PrintR: if (!m_objClass.empty()) { m_buf->append(m_objClass); m_buf->append(" Object\n"); } else { m_buf->append("Array\n"); } m_buf->append(" *RECURSION*"); break; case VarExport: throw NestingLevelTooDeepException(); case VarDump: case DebugDump: case DebuggerDump: indent(); m_buf->append("*RECURSION*\n"); break; case DebuggerSerialize: if (m_maxLevelDebugger > 0 && m_levelDebugger > m_maxLevelDebugger) { // Not recursion, just cut short of print m_buf->append("s:12:\"...(omitted)\";", 20); break; } // fall through case Serialize: case APCSerialize: { ASSERT(m_arrayIds); PointerCounterMap::const_iterator iter = m_arrayIds->find(ptr); ASSERT(iter != m_arrayIds->end()); int id = iter->second; if (isObject) { m_buf->append("r:"); m_buf->append(id); m_buf->append(';'); } else if (wasRef) { m_buf->append("R:"); m_buf->append(id); m_buf->append(';'); } else { m_buf->append("N;"); } } break; case JSON: raise_warning("json_encode(): recursion detected"); m_buf->append("null"); break; default: ASSERT(false); break; } }
void VariableSerializer::writeOverflow(void* ptr, bool isObject /* = false */) { bool wasRef = m_referenced; setReferenced(false); switch (m_type) { case PrintR: *m_out << "*RECURSION*"; break; case VarExport: throw NestingLevelTooDeepException(); case VarDump: case DebugDump: indent(); *m_out << "*RECURSION*\n"; break; case Serialize: { map<void*, int>::const_iterator iter = m_arrayIds.find(ptr); ASSERT(iter != m_arrayIds.end()); int id = iter->second; if (isObject) { *m_out << "r:" << id << ";"; } else if (wasRef) { *m_out << "R:" << id << ";"; } else { *m_out << "N;"; } } break; case JSON: *m_out << "null"; break; default: ASSERT(false); break; } }