]> granicus.if.org Git - php/commitdiff
MFH: New array_multisort() test and code comment fix (Simon Westcott)
authorChristopher Jones <sixd@php.net>
Fri, 15 May 2009 16:46:22 +0000 (16:46 +0000)
committerChristopher Jones <sixd@php.net>
Fri, 15 May 2009 16:46:22 +0000 (16:46 +0000)
ext/standard/array.c
ext/standard/tests/array/array_multisort_variation11.phpt [new file with mode: 0644]

index 46134d50609ec3172052aeef16af3227df54c841..d39c0e6bead633640eb38d94ba363526ac48950a 100644 (file)
@@ -3789,7 +3789,7 @@ PHP_FUNCTION(array_multisort)
                }
        }
 
-       /* If all arrays are empty or have only one entry, we don't need to do anything. */
+       /* If all arrays are empty we don't need to do anything. */
        if (array_size < 1) {
                for (k = 0; k < MULTISORT_LAST; k++) {
                        efree(ARRAYG(multisort_flags)[k]);
diff --git a/ext/standard/tests/array/array_multisort_variation11.phpt b/ext/standard/tests/array/array_multisort_variation11.phpt
new file mode 100644 (file)
index 0000000..520dd3d
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Test array_multisort() function : usage variation - testing with empty array
+--FILE--
+<?php
+/* Prototype  : bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : Testing with empty array ***\n";
+
+var_dump(array_multisort(array()));
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+*** Testing array_multisort() : Testing with empty array ***
+bool(true)
+===DONE===