summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/opcache/Optimizer/zend_func_info.c4
-rw-r--r--ext/standard/string.c4
-rw-r--r--ext/standard/tests/strings/implode1.phptbin5584 -> 5818 bytes
-rw-r--r--ext/standard/tests/strings/join_error.phpt12
-rw-r--r--ext/standard/tests/strings/join_variation2.phpt106
5 files changed, 43 insertions, 83 deletions
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index 651920c3cf..6d881b0f39 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -231,8 +231,8 @@ static const func_info_t func_infos[] = {
F1("strip_tags", MAY_BE_STRING),
F0("similar_text", MAY_BE_LONG),
F1("explode", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- FN("implode", MAY_BE_NULL | MAY_BE_STRING),
- FN("join", MAY_BE_NULL | MAY_BE_STRING),
+ FN("implode", MAY_BE_STRING),
+ FN("join", MAY_BE_STRING),
FN("setlocale", MAY_BE_FALSE | MAY_BE_STRING),
F1("localeconv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#if HAVE_NL_LANGINFO
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 39739c82c0..860dfd59d7 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1283,7 +1283,7 @@ PHP_FUNCTION(implode)
if (arg2 == NULL) {
if (Z_TYPE_P(arg1) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Argument must be an array");
+ zend_type_error("Argument must be an array");
return;
}
@@ -1298,7 +1298,7 @@ PHP_FUNCTION(implode)
glue = zval_get_tmp_string(arg1, &tmp_glue);
pieces = arg2;
} else {
- php_error_docref(NULL, E_WARNING, "Invalid arguments passed");
+ zend_type_error("Invalid arguments passed");
return;
}
}
diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt
index 3dc022d351..494ebaf610 100644
--- a/ext/standard/tests/strings/implode1.phpt
+++ b/ext/standard/tests/strings/implode1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt
index 832fb58c05..fa15b75da5 100644
--- a/ext/standard/tests/strings/join_error.phpt
+++ b/ext/standard/tests/strings/join_error.phpt
@@ -14,15 +14,17 @@ echo "*** Testing join() : error conditions ***\n";
echo "\n-- Testing join() with less than expected no. of arguments --\n";
$glue = 'string_val';
-var_dump( join($glue));
+try {
+ var_dump(join($glue));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing join() : error conditions ***
-- Testing join() with less than expected no. of arguments --
-
-Warning: join(): Argument must be an array in %s on line %d
-NULL
+Argument must be an array
Done
diff --git a/ext/standard/tests/strings/join_variation2.phpt b/ext/standard/tests/strings/join_variation2.phpt
index 03b3250b40..16e053cce1 100644
--- a/ext/standard/tests/strings/join_variation2.phpt
+++ b/ext/standard/tests/strings/join_variation2.phpt
@@ -86,12 +86,16 @@ $values = array (
echo "\n--- Testing join() by supplying different values for 'pieces' argument ---\n";
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
- echo "-- Iteration $counter --\n";
- $pieces = $values [$index];
+ echo "-- Iteration $counter --\n";
+ $pieces = $values [$index];
- var_dump( join($glue, $pieces) );
+ try {
+ var_dump( join($glue, $pieces) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
- $counter ++;
+ $counter ++;
}
// close the resources used
@@ -99,100 +103,54 @@ fclose($fp);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing join() : usage variations ***
--- Testing join() by supplying different values for 'pieces' argument ---
-- Iteration 1 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 2 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 3 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 4 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 5 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 6 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 7 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 8 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 9 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 10 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 11 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 12 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 13 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 14 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 15 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 16 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 17 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 18 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 19 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 20 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 21 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 22 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 23 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
Done