summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_diff_uassoc_variation14.phpt
diff options
context:
space:
mode:
authorAnt Phillips <ant@php.net>2008-12-02 13:32:53 +0000
committerAnt Phillips <ant@php.net>2008-12-02 13:32:53 +0000
commit2b1a411806c7b0e5692d5472e4f1da4b002b330e (patch)
tree1ca6b2cdf51cf89b552049a034f201cc48299083 /ext/standard/tests/array/array_diff_uassoc_variation14.phpt
parentec1ee12281edfe6bcd148ade3711fbf3996e3738 (diff)
downloadphp-git-2b1a411806c7b0e5692d5472e4f1da4b002b330e.tar.gz
Array tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit).
Diffstat (limited to 'ext/standard/tests/array/array_diff_uassoc_variation14.phpt')
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation14.phpt40
1 files changed, 40 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation14.phpt b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt
new file mode 100644
index 0000000000..a98a2800da
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_diff_uassoc() function : usage variation -Passing classWithoutToString (handling fatal error) to callback
+--FILE--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize array
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
+$array2 = array("a" => "green", "yellow", "red");
+
+class classWithoutToString
+{
+}
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+$value = new classWithoutToString();
+var_dump( array_diff_uassoc($array1, $array2, $value) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_uassoc() : usage variation ***
+Error: 2 - array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given, %s(%d)
+NULL
+===DONE===
+