Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ PHP NEWS
(Weilin Du)
. getenv() and putenv() now raises a ValueError when the first argument
contains null bytes. (Weilin Du)
. Improved explode() ValueError message when $separator is empty; suggests
str_split() or mb_str_split(). (diegoasales)
. parse_str() now raises a ValueError when the $string argument contains
null bytes. (Weilin Du)
. proc_open() now raises a ValueError when the $cwd argument contains
Expand Down
2 changes: 2 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ PHP 8.6 UPGRADE NOTES
constants).

- Standard:
. explode() ValueError message when $separator is empty now suggests
str_split() or mb_str_split().
Comment thread
TimWolla marked this conversation as resolved.
Outdated
. ini_get_all() now includes a "builtin_default_value" element for each
directive when $details is true. It holds the built-in default value of
the directive (or null if it has none), independent of values set in
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ PHP_FUNCTION(explode)
ZEND_PARSE_PARAMETERS_END();

if (ZSTR_LEN(delim) == 0) {
zend_argument_must_not_be_empty_error(1);
zend_argument_value_error(1, "must not be empty. Use str_split() or mb_str_split() to split a string into characters");
Comment thread
TimWolla marked this conversation as resolved.
Outdated
RETURN_THROWS();
}

Expand Down
8 changes: 4 additions & 4 deletions ext/standard/tests/strings/explode.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ array (
4 => 'd',
)
d6bee42a771449205344c0938ad4f035
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
array(1) {
[0]=>
string(0) ""
Expand All @@ -79,7 +79,7 @@ array(1) {
[0]=>
string(0) ""
}
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
array(1) {
[0]=>
string(3) "acb"
Expand Down
24 changes: 12 additions & 12 deletions ext/standard/tests/strings/explode1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ var_dump( explode("b", $obj) );
--EXPECT--
*** Testing explode() for basic operations ***
-- Iteration 1 --
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
-- Iteration 2 --
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
-- Iteration 3 --
array(1) {
[0]=>
Expand Down Expand Up @@ -201,10 +201,10 @@ array(2) {
string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
}
-- Iteration 7 --
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
explode(): Argument #1 ($separator) must not be empty. Use str_split() or mb_str_split() to split a string into characters
-- Iteration 8 --
array(2) {
[0]=>
Expand Down
Loading