]> granicus.if.org Git - php/commitdiff
Fixed bug #68897 (Using variable for sort flag in array_multisort cause wrong results)
authorXinchen Hui <laruence@php.net>
Sat, 24 Jan 2015 14:51:37 +0000 (22:51 +0800)
committerXinchen Hui <laruence@php.net>
Sat, 24 Jan 2015 14:51:37 +0000 (22:51 +0800)
ext/standard/array.c

index 58402854f1bd9cb5d0c132ebf490637e0fc4d394..966ea0f1f69de13359b64b89639031c9b4868be1 100644 (file)
@@ -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);