From a98fd7125ac9165822fa34a01e35a97a2076c3b9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 24 Jan 2015 22:51:37 +0800 Subject: [PATCH] Fixed bug #68897 (Using variable for sort flag in array_multisort cause wrong results) --- ext/standard/array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/array.c b/ext/standard/array.c index 58402854f1..966ea0f1f6 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4320,7 +4320,7 @@ PHP_FUNCTION(array_multisort) /* flag allowed here */ if (parse_state[MULTISORT_ORDER] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_order = Z_LVAL(args[i]) == PHP_SORT_DESC ? -1 : 1; + sort_order = Z_LVAL_P(arg) == PHP_SORT_DESC ? -1 : 1; parse_state[MULTISORT_ORDER] = 0; } else { php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); @@ -4338,7 +4338,7 @@ PHP_FUNCTION(array_multisort) /* flag allowed here */ if (parse_state[MULTISORT_TYPE] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_type = (int)Z_LVAL(args[i]); + sort_type = (int)Z_LVAL_P(arg); parse_state[MULTISORT_TYPE] = 0; } else { php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); -- 2.40.0