Created
December 5, 2013 19:57
-
-
Save simonwelsh/7812789 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/hphp/runtime/vm/member-operations.h b/hphp/runtime/vm/member-operations.h | |
index 806c6c6..fea0229 100644 | |
--- a/hphp/runtime/vm/member-operations.h | |
+++ b/hphp/runtime/vm/member-operations.h | |
@@ -192,32 +192,35 @@ | |
template <bool warn, KeyType keyType> | |
inline TypedValue* ElemArray(ArrayData* base, TypedValue* key) { | |
TypedValue* result; | |
if (keyType == KeyType::Any) { | |
DataType rtt = key->m_type; | |
if (rtt == KindOfInt64) { | |
result = ElemArrayRawKey(base, key->m_data.num); | |
} else if (IS_STRING_TYPE(rtt)) { | |
result = ElemArrayRawKey(base, key->m_data.pstr); | |
} else { | |
result = const_cast<TypedValue*>(ArrNR(base).asArray() | |
.rvalAtRef(cellAsCVarRef(*key)) | |
.asTypedValue()); | |
+ if (result->m_type == KindOfUninit) { | |
+ result = const_cast<TypedValue*>(init_null_variant.asTypedValue()); | |
+ } | |
} | |
} else { | |
result = ElemArrayRawKey(base, keyAsRaw<keyType>(key)); | |
} | |
if (UNLIKELY(result->m_type == KindOfUninit)) { | |
result = const_cast<TypedValue*>(init_null_variant.asTypedValue()); | |
if (warn) { | |
TypedValue scratch; | |
initScratchKey<keyType>(scratch, key); | |
raise_notice(Strings::UNDEFINED_INDEX, | |
tvAsCVarRef(key).toString().data()); | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment