diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-09-11 11:06:57 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-09-11 11:06:57 +0400 |
commit | 1981dd9c73ada7ea893b4636b84211f68838ba23 (patch) | |
tree | 10685f35448e5afd4b970ccebf5fa9ce01953e48 /ext/ereg/tests/split_variation_003.phpt | |
parent | 98b8050433d25cc9c173360e01272836acd7307f (diff) | |
download | php-git-1981dd9c73ada7ea893b4636b84211f68838ba23.tar.gz |
Revert "Removing ext/ereg and dependencies"
This reverts commit 86de7963fe69638431c0aa8f413d25e01bf99d68.
Diffstat (limited to 'ext/ereg/tests/split_variation_003.phpt')
-rw-r--r-- | ext/ereg/tests/split_variation_003.phpt | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/ext/ereg/tests/split_variation_003.phpt b/ext/ereg/tests/split_variation_003.phpt new file mode 100644 index 0000000000..edef9cfeb9 --- /dev/null +++ b/ext/ereg/tests/split_variation_003.phpt @@ -0,0 +1,231 @@ +--TEST-- +Test split() function : usage variations - unexpected type for arg 3 +--FILE-- +<?php +/* Prototype : proto array split(string pattern, string string [, int limit]) + * Description: Split string into array by regular expression + * Source code: ext/standard/reg.c + * Alias to functions: + */ + +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'); +echo "*** Testing split() : usage variations ***\n"; + +// Initialise function arguments not being substituted (if any) +$pattern = b'[[:space:]]'; +$string = '1 2 3 4 5'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//array of values to iterate over +$values = array( + + // float data + 10.5, + -10.5, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, +); + +// loop through each element of the array for limit + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( split($pattern, $string, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing split() : usage variations *** + +Arg value 10.5 +Error: 8192 - Function split() is deprecated, %s(73) +array(5) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" +} + +Arg value -10.5 +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 1.07654321E-9 +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 0.5 +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d) + +Arg value Array +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d) + +Arg value Array +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d) + +Arg value Array +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d) + +Arg value Array +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d) + +Arg value Array +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, array given, %s(73) +NULL + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 1 +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 1 +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, string given, %s(73) +NULL + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, string given, %s(73) +NULL + +Arg value string +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, string given, %s(73) +NULL + +Arg value string +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, string given, %s(73) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(72) + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +Error: 2 - split() expects parameter 3 to be long, object given, %s(73) +NULL + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +Error: 8192 - Function split() is deprecated, %s(73) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Done
\ No newline at end of file |