summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/explode.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/strings/explode.phpt')
-rw-r--r--ext/standard/tests/strings/explode.phpt56
1 files changed, 38 insertions, 18 deletions
diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt
index 84cdcb985f..8fa3b62079 100644
--- a/ext/standard/tests/strings/explode.phpt
+++ b/ext/standard/tests/strings/explode.phpt
@@ -8,21 +8,40 @@ error_reporting=2047
<?php
/* From http://bugs.php.net/19865 */
echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE);
+echo "\n";
echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE));
echo "\n";
-var_dump(@explode("", ""));
-var_dump(@explode("", NULL));
-var_dump(@explode(NULL, ""));
-var_dump(@explode("a", ""));
-var_dump(@explode("a", "a"));
-var_dump(@explode("a", NULL));
-var_dump(@explode(NULL, "a"));
-var_dump(@explode("abc", "acb"));
-var_dump(@explode("somestring", "otherstring"));
-var_dump(@explode("somestring", "otherstring", -1));
-var_dump(@explode("a", "aaaaaa"));
-var_dump(@explode("==", str_repeat("-=".ord(0)."=-", 10)));
-var_dump(@explode("=", str_repeat("-=".ord(0)."=-", 10)));
+
+try {
+ var_dump(explode("", ""));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump(explode("", NULL));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump(explode(NULL, ""));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+var_dump(explode("a", ""));
+var_dump(explode("a", "a"));
+var_dump(explode("a", NULL));
+try {
+ var_dump(explode(NULL, "a"));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+var_dump(explode("abc", "acb"));
+var_dump(explode("somestring", "otherstring"));
+var_dump(explode("somestring", "otherstring", -1));
+var_dump(explode("a", "aaaaaa"));
+var_dump(explode("==", str_repeat("-=".ord(0)."=-", 10)));
+var_dump(explode("=", str_repeat("-=".ord(0)."=-", 10)));
//////////////////////////////////////
var_dump(explode(":","a lazy dog:jumps:over:",-1));
var_dump(explode(":","a lazy dog:jumps:over", -1));
@@ -39,10 +58,11 @@ array (
2 => 'f',
3 => '1',
4 => 'd',
-)d6bee42a771449205344c0938ad4f035
-bool(false)
-bool(false)
-bool(false)
+)
+d6bee42a771449205344c0938ad4f035
+Empty delimiter
+Empty delimiter
+Empty delimiter
array(1) {
[0]=>
string(0) ""
@@ -57,7 +77,7 @@ array(1) {
[0]=>
string(0) ""
}
-bool(false)
+Empty delimiter
array(1) {
[0]=>
string(3) "acb"