diff --git a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp index 719a18675..1a01967d3 100644 --- a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp @@ -167,6 +167,12 @@ void VectorEffects::init(Opcode op, const Type origBase, valType = definitelyFail ? Type::InitNull : (valType | Type::InitNull); } + if (op == SetElem && baseType.maybe(Type::Str)) { + // If the base is a String, the result will be different from the value + // use valTypeChanged (even though the type may not have) + valTypeChanged = true; + } + // The final baseType should be a pointer/box iff the input was baseType = baseBoxed ? baseType.box() : baseType; baseType = basePtr ? baseType.ptr() : baseType; diff --git a/hphp/test/vm/setmstr2.php b/hphp/test/vm/setmstr2.php new file mode 100644 index 000000000..24b5cdae7 --- /dev/null +++ b/hphp/test/vm/setmstr2.php @@ -0,0 +1,10 @@ +