summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/explode1.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/strings/explode1.phpt')
-rw-r--r--ext/standard/tests/strings/explode1.phpt90
1 files changed, 35 insertions, 55 deletions
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
index 6842947605..4d692e49e8 100644
--- a/ext/standard/tests/strings/explode1.phpt
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -32,12 +32,29 @@ $string = "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND";
*/
$counter = 1;
foreach($delimiters as $delimiter) {
- echo "-- Iteration $counter --\n";
- var_dump( explode($delimiter, $string, -1) );
- var_dump( explode($delimiter, $string, 0) );
- var_dump( explode($delimiter, $string, 1) );
- var_dump( explode($delimiter, $string, 2) );
- $counter++;
+ echo "-- Iteration $counter --\n";
+
+ try {
+ var_dump( explode($delimiter, $string, -1) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 0) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 1) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 2) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ $counter++;
}
echo "\n*** Testing explode() with miscelleneous input arguments ***\n";
@@ -77,41 +94,20 @@ class string1 {
$obj = new string1;
var_dump( explode("b", $obj) );
-echo "\n*** Testing error conditions ***\n";
-/* checking for arguments <2 and >3 */
-var_dump( explode(":", "array1:array2:array3", -1, -33) );
-var_dump( explode(":") );
-
echo "Done\n";
?>
--EXPECTF--
*** Testing explode() for basic operations ***
-- Iteration 1 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 2 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 3 --
array(1) {
[0]=>
@@ -213,18 +209,10 @@ array(2) {
string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
}
-- Iteration 7 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 8 --
array(2) {
[0]=>
@@ -498,12 +486,4 @@ array(2) {
[1]=>
string(4) "ject"
}
-
-*** Testing error conditions ***
-
-Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: explode() expects at least 2 parameters, 1 given in %s on line %d
-NULL
Done