summaryrefslogtreecommitdiff
path: root/ext/standard/tests
diff options
context:
space:
mode:
authorColin O'Dell <colinodell@gmail.com>2019-10-21 17:22:04 -0400
committerNikita Popov <nikita.ppv@gmail.com>2019-10-23 11:22:12 +0200
commite7335eb420e40d2226fbf1c2b573875323667560 (patch)
tree20a1c59dbb337e8f255ce3a5eeaa69529b4771b3 /ext/standard/tests
parent80103bdb78544495d6a34cbd75fac25492832a95 (diff)
downloadphp-git-e7335eb420e40d2226fbf1c2b573875323667560.tar.gz
Allow array_splice() length to be null
Diffstat (limited to 'ext/standard/tests')
-rw-r--r--ext/standard/tests/array/array_splice_basic.phpt19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_splice_basic.phpt b/ext/standard/tests/array/array_splice_basic.phpt
index 9a96ccb362..cf6fcd1db2 100644
--- a/ext/standard/tests/array/array_splice_basic.phpt
+++ b/ext/standard/tests/array/array_splice_basic.phpt
@@ -14,6 +14,12 @@ var_dump (array_splice($input, 2));
var_dump ($input);
// $input is now array("red", "green")
+echo "test truncation with null length \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 2, null));
+var_dump ($input);
+// $input is now array("red", "green")
+
echo "test removing entries from the middle \n";
$input = array("red", "green", "blue", "yellow");
var_dump (array_splice($input, 1, -1));
@@ -56,6 +62,19 @@ array(2) {
[1]=>
string(5) "green"
}
+test truncation with null length
+array(2) {
+ [0]=>
+ string(4) "blue"
+ [1]=>
+ string(6) "yellow"
+}
+array(2) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "green"
+}
test removing entries from the middle
array(2) {
[0]=>