From c4b56e312d6776893fe54c43ee65a242cb5a6759 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Wed, 3 Apr 2013 19:24:33 -0700 Subject: [PATCH] Fix UnsetM with global base If the global was not defined, it would try to return a pointer into the MInstrCtx, which was not passed in. We dont actually need it though, because in that case we can just return a pointer to init_null_variant. --- hphp/runtime/vm/translator/hopt/vectortranslator.cpp | 3 +-- hphp/test/vm/unset_undef_g.php | 5 +++++ hphp/test/vm/unset_undef_g.php.exp | 0 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 hphp/test/vm/unset_undef_g.php create mode 100644 hphp/test/vm/unset_undef_g.php.exp diff --git a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp index 46459870b..cf4a3236d 100644 --- a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp @@ -600,8 +600,7 @@ static inline TypedValue* baseGImpl(TypedValue *key, varEnv->set(name, &tv); base = varEnv->lookup(name); } else { - tvWriteNull(&mis->tvScratch); - base = &mis->tvScratch; + return const_cast(init_null_variant.asTypedValue()); } } decRefStr(name); diff --git a/hphp/test/vm/unset_undef_g.php b/hphp/test/vm/unset_undef_g.php new file mode 100644 index 000000000..3a1e6c52d --- /dev/null +++ b/hphp/test/vm/unset_undef_g.php @@ -0,0 +1,5 @@ +