-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove some deprecated functions #4927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
64a88de
071e4e5
1113aab
d517a7e
54605ac
b8308c1
0afe10b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1264,16 +1264,16 @@ PHPAPI void php_implode(const zend_string *glue, zval *pieces, zval *return_valu | |
Joins array elements placing glue string between items and return one string */ | ||
PHP_FUNCTION(implode) | ||
{ | ||
zval *arg1, *arg2 = NULL, *pieces; | ||
zval *arg1, *pieces = NULL; | ||
zend_string *glue, *tmp_glue; | ||
|
||
ZEND_PARSE_PARAMETERS_START(1, 2) | ||
Z_PARAM_ZVAL(arg1) | ||
Z_PARAM_OPTIONAL | ||
Z_PARAM_ZVAL(arg2) | ||
Z_PARAM_ARRAY(pieces) | ||
ZEND_PARSE_PARAMETERS_END(); | ||
|
||
if (arg2 == NULL) { | ||
if (pieces == NULL) { | ||
if (Z_TYPE_P(arg1) != IS_ARRAY) { | ||
zend_type_error("Argument must be an array"); | ||
return; | ||
|
@@ -1283,16 +1283,10 @@ PHP_FUNCTION(implode) | |
tmp_glue = NULL; | ||
pieces = arg1; | ||
} else { | ||
if (Z_TYPE_P(arg1) == IS_ARRAY) { | ||
glue = zval_get_tmp_string(arg2, &tmp_glue); | ||
pieces = arg1; | ||
php_error_docref(NULL, E_DEPRECATED, | ||
"Passing glue string after array is deprecated. Swap the parameters"); | ||
} else if (Z_TYPE_P(arg2) == IS_ARRAY) { | ||
if (Z_TYPE_P(arg1) == IS_STRING) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, this changes the behavior: Previously it would cast anything (that isn't an array) to a string, now it strictly requires a string. Ideally it would follow zpp rules... |
||
glue = zval_get_tmp_string(arg1, &tmp_glue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also get rid of tmp_glue and zend_tmp_string_release, because Z_PARAM_STR gives you the zend_string |
||
pieces = arg2; | ||
} else { | ||
zend_type_error("Invalid arguments passed"); | ||
zend_type_error("The first argument must be string"); | ||
return; | ||
} | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.