]> granicus.if.org Git - php/commitdiff
add extra test to protected behavior of compact and array string key order
authorMárcio Almada <marcio3w@gmail.com>
Thu, 1 Sep 2016 07:52:54 +0000 (03:52 -0400)
committerNikita Popov <nikic@php.net>
Thu, 1 Sep 2016 11:01:42 +0000 (13:01 +0200)
ext/standard/tests/array/compact_order.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/array/compact_order.phpt b/ext/standard/tests/array/compact_order.phpt
new file mode 100644 (file)
index 0000000..bf6051c
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+compact() and hashmap order
+--FILE--
+<?php
+
+$foo = null;
+$bar = null;
+
+var_dump(compact('foo', 'bar'));
+var_dump(compact('bar', 'foo'));
+
+?>
+--EXPECT--
+array(2) {
+  ["foo"]=>
+  NULL
+  ["bar"]=>
+  NULL
+}
+array(2) {
+  ["bar"]=>
+  NULL
+  ["foo"]=>
+  NULL
+}