diff --git a/hphp/runtime/base/variable_serializer.cpp b/hphp/runtime/base/variable_serializer.cpp index d6fa899d7..4eb3dfa78 100644 --- a/hphp/runtime/base/variable_serializer.cpp +++ b/hphp/runtime/base/variable_serializer.cpp @@ -69,6 +69,7 @@ void VariableSerializer::getResourceInfo(String &rsrcName, int &rsrcId) { void VariableSerializer::setResourceInfo(CStrRef rsrcName, int rsrcId) { m_rsrcName = rsrcName; m_rsrcId = rsrcId; + m_objCode = 0; } String VariableSerializer::serialize(CVarRef v, bool ret) { @@ -849,7 +850,7 @@ void VariableSerializer::writeArrayFooter() { case Type::VarExport: case Type::PHPOutput: indent(); - if (info.is_object) { + if (info.is_object && m_objCode) { if (m_objCode == 'O') { m_buf->append("))"); } else { diff --git a/hphp/test/slow/var_export/resource.php b/hphp/test/slow/var_export/resource.php new file mode 100644 index 000000000..dffd539b1 --- /dev/null +++ b/hphp/test/slow/var_export/resource.php @@ -0,0 +1,8 @@ +