mirror of
https://github.com/php/php-src.git
synced 2026-04-01 05:02:27 +02:00
Allow mixing Unicode/binary string types.
This commit is contained in:
@@ -1179,26 +1179,12 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *retval TSRMLS_DC)
|
||||
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&tmp, &pos) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) != return_type) {
|
||||
if (return_type == IS_UNICODE) {
|
||||
if (Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
/* ERROR */
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Cannot mix binary strings with other string types");
|
||||
efree(Z_USTRVAL_P(retval));
|
||||
ZVAL_FALSE(retval);
|
||||
return;
|
||||
} else {
|
||||
if (Z_TYPE_PP(tmp) != IS_UNICODE) {
|
||||
SEPARATE_ZVAL(tmp);
|
||||
convert_to_unicode_ex(tmp);
|
||||
}
|
||||
} else if (return_type == IS_STRING) {
|
||||
if (Z_TYPE_PP(tmp) == IS_UNICODE) {
|
||||
/* ERROR */
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Cannot mix binary strings with other string types");
|
||||
efree(Z_STRVAL_P(retval));
|
||||
ZVAL_FALSE(retval);
|
||||
return;
|
||||
} else {
|
||||
if (Z_TYPE_PP(tmp) != IS_STRING) {
|
||||
SEPARATE_ZVAL(tmp);
|
||||
convert_to_string_ex(tmp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user