summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/in_array_errors.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/in_array_errors.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/array/in_array_errors.phpt')
-rw-r--r--ext/standard/tests/array/in_array_errors.phpt45
1 files changed, 45 insertions, 0 deletions
diff --git a/ext/standard/tests/array/in_array_errors.phpt b/ext/standard/tests/array/in_array_errors.phpt
new file mode 100644
index 0000000..13a6cdb
--- /dev/null
+++ b/ext/standard/tests/array/in_array_errors.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test in_array() function : error conditions
+--FILE--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+echo "\n*** Testing error conditions of in_array() ***\n";
+/* zero argument */
+var_dump( in_array() );
+
+/* unexpected no.of arguments in in_array() */
+$var = array("mon", "tues", "wed", "thurs");
+var_dump( in_array(1, $var, 0, "test") );
+var_dump( in_array("test") );
+
+/* unexpected second argument in in_array() */
+$var="test";
+var_dump( in_array("test", $var) );
+var_dump( in_array(1, 123) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions of in_array() ***
+
+Warning: in_array() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: in_array() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+Warning: in_array() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: in_array() expects parameter 2 to be array, string given in %s on line %d
+NULL
+
+Warning: in_array() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+Done