Use RETURN_THROWS() after try_convert_to_string()

This commit is contained in:
Máté Kocsis 2020-01-03 17:04:06 +01:00
parent 1658b5babc
commit 7b4a4d2ace
No known key found for this signature in database
GPG key ID: FD055E41728BF310
17 changed files with 30 additions and 30 deletions

View file

@ -4434,7 +4434,7 @@ PHP_FUNCTION(exif_read_data)
ret = exif_read_from_stream(&ImageInfo, p_stream, read_thumbnail, read_all);
} else {
if (!try_convert_to_string(stream)) {
return;
RETURN_THROWS();
}
if (!Z_STRLEN_P(stream)) {
@ -4607,7 +4607,7 @@ PHP_FUNCTION(exif_thumbnail)
ret = exif_read_from_stream(&ImageInfo, p_stream, 1, 0);
} else {
if (!try_convert_to_string(stream)) {
return;
RETURN_THROWS();
}
if (!Z_STRLEN_P(stream)) {

View file

@ -1693,7 +1693,7 @@ PHP_FUNCTION(imap_delete)
}
if (!try_convert_to_string(sequence)) {
return;
RETURN_THROWS();
}
mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_P(sequence), "\\DELETED", (argc == 3 ? flags : NIL));
@ -1719,7 +1719,7 @@ PHP_FUNCTION(imap_undelete)
}
if (!try_convert_to_string(sequence)) {
return;
RETURN_THROWS();
}
mail_clearflag_full(imap_le_struct->imap_stream, Z_STRVAL_P(sequence), "\\DELETED", (argc == 3 ? flags : NIL));
@ -2140,7 +2140,7 @@ PHP_FUNCTION(imap_savebody)
default:
if (!try_convert_to_string(out)) {
return;
RETURN_THROWS();
}
writer = php_stream_open_wrapper(Z_STRVAL_P(out), "wb", REPORT_ERRORS, NULL);
break;

View file

@ -141,7 +141,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format);
} else {
if (!try_convert_to_string(format)) {
return;
RETURN_THROWS();
}
if (Z_STRLEN_P(format) == 0) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,

View file

@ -164,7 +164,7 @@ double_offset:
zend_long lval;
double dval;
if (!try_convert_to_string(arg)) {
return;
RETURN_THROWS();
}
switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) {
case IS_DOUBLE:

View file

@ -316,7 +316,7 @@ PHP_FUNCTION( transliterator_transliterate )
{ /* not a transliterator object as first argument */
int res;
if( !try_convert_to_string( arg1 ) ) {
return;
RETURN_THROWS();
}
object = &tmp_object;
res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ),

View file

@ -1600,7 +1600,7 @@ PHP_FUNCTION(mb_detect_order)
break;
default:
if (!try_convert_to_string(arg1)) {
return;
RETURN_THROWS();
}
if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0)) {
if (list) {
@ -2878,7 +2878,7 @@ PHP_FUNCTION(mb_convert_encoding)
if (Z_TYPE_P(input) != IS_STRING && Z_TYPE_P(input) != IS_ARRAY) {
if (!try_convert_to_string(input)) {
return;
RETURN_THROWS();
}
}
@ -2917,7 +2917,7 @@ PHP_FUNCTION(mb_convert_encoding)
break;
default:
if (!try_convert_to_string(arg_old)) {
return;
RETURN_THROWS();
}
_from_encodings = Z_STRVAL_P(arg_old);
@ -3096,7 +3096,7 @@ PHP_FUNCTION(mb_detect_encoding)
break;
default:
if (!try_convert_to_string(encoding_list)) {
return;
RETURN_THROWS();
}
if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0)) {
if (list) {
@ -3507,7 +3507,7 @@ PHP_FUNCTION(mb_convert_variables)
break;
default:
if (!try_convert_to_string(zfrom_enc)) {
return;
RETURN_THROWS();
}
php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRLEN_P(zfrom_enc), &elist, &elistsz, 0);
break;
@ -4464,7 +4464,7 @@ PHP_FUNCTION(mb_check_encoding)
}
} else {
if (!try_convert_to_string(input)) {
RETURN_FALSE;
RETURN_THROWS();
}
if (!php_mb_check_encoding(Z_STRVAL_P(input), Z_STRLEN_P(input), enc ? ZSTR_VAL(enc): NULL)) {
RETURN_FALSE;

View file

@ -898,7 +898,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
switch (stmt->stmt->params[i].buffer_type) {
case MYSQL_TYPE_VAR_STRING:
if (!try_convert_to_string(param)) {
return;
RETURN_THROWS();
}
stmt->stmt->params[i].buffer = Z_STRVAL_P(param);
@ -1791,7 +1791,7 @@ PHP_FUNCTION(mysqli_options)
switch (expected_type) {
case IS_STRING:
if (!try_convert_to_string(mysql_value)) {
return;
RETURN_THROWS();
}
break;
case IS_LONG:

View file

@ -1095,7 +1095,7 @@ PHP_FUNCTION(odbc_execute)
}
}
efree(params);
RETURN_FALSE;
RETURN_THROWS();
}
params[i-1].vallen = Z_STRLEN_P(tmp);

View file

@ -862,7 +862,7 @@ PHP_FUNCTION(pcntl_exec)
if (argi >= argc) break;
if (!try_convert_to_string(element)) {
efree(argv);
return;
RETURN_THROWS();
}
*current_arg = Z_STRVAL_P(element);
@ -895,7 +895,7 @@ PHP_FUNCTION(pcntl_exec)
zend_string_release(key);
efree(argv);
efree(envp);
return;
RETURN_THROWS();
}
/* Length of element + equal sign + length of key + null */

View file

@ -592,7 +592,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
size_t query_len;
if (!try_convert_to_string(tmp)) {
efree(query);
return;
RETURN_THROWS();
}
if (buffer_len < Z_STRLEN_P(tmp)) {

View file

@ -223,7 +223,7 @@ PHP_FUNCTION(readline_info)
if (value) {
/* XXX if (rl_line_buffer) free(rl_line_buffer); */
if (!try_convert_to_string(value)) {
return;
RETURN_THROWS();
}
rl_line_buffer = strdup(Z_STRVAL_P(value));
}
@ -248,7 +248,7 @@ PHP_FUNCTION(readline_info)
oldval = rl_pending_input;
if (value) {
if (!try_convert_to_string(value)) {
return;
RETURN_THROWS();
}
rl_pending_input = Z_STRVAL_P(value)[0];
}
@ -267,7 +267,7 @@ PHP_FUNCTION(readline_info)
oldval = rl_completion_append_character;
if (value) {
if (!try_convert_to_string(value)) {
return;
RETURN_THROWS();
}
rl_completion_append_character = (int)Z_STRVAL_P(value)[0];
}
@ -292,7 +292,7 @@ PHP_FUNCTION(readline_info)
if (value) {
/* XXX if (rl_readline_name) free(rl_readline_name); */
if (!try_convert_to_string(value)) {
return;
RETURN_THROWS();
}
rl_readline_name = strdup(Z_STRVAL_P(value));
}

View file

@ -3802,7 +3802,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
}
} else {
if (!try_convert_to_string(argument)) {
return;
RETURN_THROWS();
}
if ((ce = zend_lookup_class(Z_STR_P(argument))) == NULL) {

View file

@ -2717,7 +2717,7 @@ PHP_FUNCTION(highlight_string)
ZEND_PARSE_PARAMETERS_END();
if (!try_convert_to_string(expr)) {
return;
RETURN_THROWS();
}
if (i) {

View file

@ -1001,7 +1001,7 @@ PHP_FUNCTION(base_convert)
ZEND_PARSE_PARAMETERS_END();
if (!try_convert_to_string(number)) {
return;
RETURN_THROWS();
}
if (frombase < 2 || frombase > 36) {

View file

@ -298,7 +298,7 @@ PHP_FUNCTION(pack)
if (!try_convert_to_string(&argv[currentarg])) {
efree(formatcodes);
efree(formatargs);
return;
RETURN_THROWS();
}
arg = Z_STRLEN(argv[currentarg]);

View file

@ -1576,7 +1576,7 @@ PHP_FUNCTION(stream_is_local)
wrapper = stream->wrapper;
} else {
if (!try_convert_to_string(zstream)) {
return;
RETURN_THROWS();
}
wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0);

View file

@ -1514,7 +1514,7 @@ PHP_FUNCTION(xml_parser_set_option)
case PHP_XML_OPTION_TARGET_ENCODING: {
const xml_encoding *enc;
if (!try_convert_to_string(val)) {
return;
RETURN_THROWS();
}
enc = xml_get_encoding((XML_Char*)Z_STRVAL_P(val));