From f48de277d45979afa78e4b37145a9df9e20d3a28 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Fri, 26 Apr 2013 12:02:10 -0700 Subject: [PATCH] array_values dropped references It should preserve them. This was breaking pass-by-reference via ReflectionFunction::invokeArgs. --- hphp/runtime/base/type_array.cpp | 2 +- hphp/test/quick/array_values.php | 6 ++++++ hphp/test/quick/array_values.php.expect | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 hphp/test/quick/array_values.php create mode 100644 hphp/test/quick/array_values.php.expect diff --git a/hphp/runtime/base/type_array.cpp b/hphp/runtime/base/type_array.cpp index 613fea592..bc5d3a0ab 100644 --- a/hphp/runtime/base/type_array.cpp +++ b/hphp/runtime/base/type_array.cpp @@ -703,7 +703,7 @@ Array Array::keys(CVarRef search_value /* = null_variant */, Array Array::values() const { ArrayInit ai(size(), ArrayInit::vectorInit); for (ArrayIter iter(*this); iter; ++iter) { - ai.set(iter.secondRef()); + ai.set(withRefBind(iter.secondRef())); } return ai.create(); } diff --git a/hphp/test/quick/array_values.php b/hphp/test/quick/array_values.php new file mode 100644 index 000000000..483c9625b --- /dev/null +++ b/hphp/test/quick/array_values.php @@ -0,0 +1,6 @@ + + &string(1) "b" +}