Skip to content

Commit 7b4a4d2

Browse files
committed
Use RETURN_THROWS() after try_convert_to_string()
1 parent 1658b5b commit 7b4a4d2

File tree

17 files changed

+30
-30
lines changed

17 files changed

+30
-30
lines changed

ext/exif/exif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4434,7 +4434,7 @@ PHP_FUNCTION(exif_read_data)
44344434
ret = exif_read_from_stream(&ImageInfo, p_stream, read_thumbnail, read_all);
44354435
} else {
44364436
if (!try_convert_to_string(stream)) {
4437-
return;
4437+
RETURN_THROWS();
44384438
}
44394439

44404440
if (!Z_STRLEN_P(stream)) {
@@ -4607,7 +4607,7 @@ PHP_FUNCTION(exif_thumbnail)
46074607
ret = exif_read_from_stream(&ImageInfo, p_stream, 1, 0);
46084608
} else {
46094609
if (!try_convert_to_string(stream)) {
4610-
return;
4610+
RETURN_THROWS();
46114611
}
46124612

46134613
if (!Z_STRLEN_P(stream)) {

ext/imap/php_imap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ PHP_FUNCTION(imap_delete)
16931693
}
16941694

16951695
if (!try_convert_to_string(sequence)) {
1696-
return;
1696+
RETURN_THROWS();
16971697
}
16981698

16991699
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)
17191719
}
17201720

17211721
if (!try_convert_to_string(sequence)) {
1722-
return;
1722+
RETURN_THROWS();
17231723
}
17241724

17251725
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)
21402140

21412141
default:
21422142
if (!try_convert_to_string(out)) {
2143-
return;
2143+
RETURN_THROWS();
21442144
}
21452145
writer = php_stream_open_wrapper(Z_STRVAL_P(out), "wb", REPORT_ERRORS, NULL);
21462146
break;

ext/intl/dateformat/dateformat_format_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
141141
dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format);
142142
} else {
143143
if (!try_convert_to_string(format)) {
144-
return;
144+
RETURN_THROWS();
145145
}
146146
if (Z_STRLEN_P(format) == 0) {
147147
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,

ext/intl/timezone/timezone_methods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration)
164164
zend_long lval;
165165
double dval;
166166
if (!try_convert_to_string(arg)) {
167-
return;
167+
RETURN_THROWS();
168168
}
169169
switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) {
170170
case IS_DOUBLE:

ext/intl/transliterator/transliterator_methods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ PHP_FUNCTION( transliterator_transliterate )
316316
{ /* not a transliterator object as first argument */
317317
int res;
318318
if( !try_convert_to_string( arg1 ) ) {
319-
return;
319+
RETURN_THROWS();
320320
}
321321
object = &tmp_object;
322322
res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ),

ext/mbstring/mbstring.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ PHP_FUNCTION(mb_detect_order)
16001600
break;
16011601
default:
16021602
if (!try_convert_to_string(arg1)) {
1603-
return;
1603+
RETURN_THROWS();
16041604
}
16051605
if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0)) {
16061606
if (list) {
@@ -2878,7 +2878,7 @@ PHP_FUNCTION(mb_convert_encoding)
28782878

28792879
if (Z_TYPE_P(input) != IS_STRING && Z_TYPE_P(input) != IS_ARRAY) {
28802880
if (!try_convert_to_string(input)) {
2881-
return;
2881+
RETURN_THROWS();
28822882
}
28832883
}
28842884

@@ -2917,7 +2917,7 @@ PHP_FUNCTION(mb_convert_encoding)
29172917
break;
29182918
default:
29192919
if (!try_convert_to_string(arg_old)) {
2920-
return;
2920+
RETURN_THROWS();
29212921
}
29222922

29232923
_from_encodings = Z_STRVAL_P(arg_old);
@@ -3096,7 +3096,7 @@ PHP_FUNCTION(mb_detect_encoding)
30963096
break;
30973097
default:
30983098
if (!try_convert_to_string(encoding_list)) {
3099-
return;
3099+
RETURN_THROWS();
31003100
}
31013101
if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0)) {
31023102
if (list) {
@@ -3507,7 +3507,7 @@ PHP_FUNCTION(mb_convert_variables)
35073507
break;
35083508
default:
35093509
if (!try_convert_to_string(zfrom_enc)) {
3510-
return;
3510+
RETURN_THROWS();
35113511
}
35123512
php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRLEN_P(zfrom_enc), &elist, &elistsz, 0);
35133513
break;
@@ -4464,7 +4464,7 @@ PHP_FUNCTION(mb_check_encoding)
44644464
}
44654465
} else {
44664466
if (!try_convert_to_string(input)) {
4467-
RETURN_FALSE;
4467+
RETURN_THROWS();
44684468
}
44694469
if (!php_mb_check_encoding(Z_STRVAL_P(input), Z_STRLEN_P(input), enc ? ZSTR_VAL(enc): NULL)) {
44704470
RETURN_FALSE;

ext/mysqli/mysqli_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
898898
switch (stmt->stmt->params[i].buffer_type) {
899899
case MYSQL_TYPE_VAR_STRING:
900900
if (!try_convert_to_string(param)) {
901-
return;
901+
RETURN_THROWS();
902902
}
903903

904904
stmt->stmt->params[i].buffer = Z_STRVAL_P(param);
@@ -1791,7 +1791,7 @@ PHP_FUNCTION(mysqli_options)
17911791
switch (expected_type) {
17921792
case IS_STRING:
17931793
if (!try_convert_to_string(mysql_value)) {
1794-
return;
1794+
RETURN_THROWS();
17951795
}
17961796
break;
17971797
case IS_LONG:

ext/odbc/php_odbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ PHP_FUNCTION(odbc_execute)
10951095
}
10961096
}
10971097
efree(params);
1098-
RETURN_FALSE;
1098+
RETURN_THROWS();
10991099
}
11001100

11011101
params[i-1].vallen = Z_STRLEN_P(tmp);

ext/pcntl/pcntl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ PHP_FUNCTION(pcntl_exec)
862862
if (argi >= argc) break;
863863
if (!try_convert_to_string(element)) {
864864
efree(argv);
865-
return;
865+
RETURN_THROWS();
866866
}
867867

868868
*current_arg = Z_STRVAL_P(element);
@@ -895,7 +895,7 @@ PHP_FUNCTION(pcntl_exec)
895895
zend_string_release(key);
896896
efree(argv);
897897
efree(envp);
898-
return;
898+
RETURN_THROWS();
899899
}
900900

901901
/* Length of element + equal sign + length of key + null */

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
592592
size_t query_len;
593593
if (!try_convert_to_string(tmp)) {
594594
efree(query);
595-
return;
595+
RETURN_THROWS();
596596
}
597597

598598
if (buffer_len < Z_STRLEN_P(tmp)) {

ext/readline/readline.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ PHP_FUNCTION(readline_info)
223223
if (value) {
224224
/* XXX if (rl_line_buffer) free(rl_line_buffer); */
225225
if (!try_convert_to_string(value)) {
226-
return;
226+
RETURN_THROWS();
227227
}
228228
rl_line_buffer = strdup(Z_STRVAL_P(value));
229229
}
@@ -248,7 +248,7 @@ PHP_FUNCTION(readline_info)
248248
oldval = rl_pending_input;
249249
if (value) {
250250
if (!try_convert_to_string(value)) {
251-
return;
251+
RETURN_THROWS();
252252
}
253253
rl_pending_input = Z_STRVAL_P(value)[0];
254254
}
@@ -267,7 +267,7 @@ PHP_FUNCTION(readline_info)
267267
oldval = rl_completion_append_character;
268268
if (value) {
269269
if (!try_convert_to_string(value)) {
270-
return;
270+
RETURN_THROWS();
271271
}
272272
rl_completion_append_character = (int)Z_STRVAL_P(value)[0];
273273
}
@@ -292,7 +292,7 @@ PHP_FUNCTION(readline_info)
292292
if (value) {
293293
/* XXX if (rl_readline_name) free(rl_readline_name); */
294294
if (!try_convert_to_string(value)) {
295-
return;
295+
RETURN_THROWS();
296296
}
297297
rl_readline_name = strdup(Z_STRVAL_P(value));
298298
}

ext/reflection/php_reflection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3802,7 +3802,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
38023802
}
38033803
} else {
38043804
if (!try_convert_to_string(argument)) {
3805-
return;
3805+
RETURN_THROWS();
38063806
}
38073807

38083808
if ((ce = zend_lookup_class(Z_STR_P(argument))) == NULL) {

ext/standard/basic_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ PHP_FUNCTION(highlight_string)
27172717
ZEND_PARSE_PARAMETERS_END();
27182718

27192719
if (!try_convert_to_string(expr)) {
2720-
return;
2720+
RETURN_THROWS();
27212721
}
27222722

27232723
if (i) {

ext/standard/math.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ PHP_FUNCTION(base_convert)
10011001
ZEND_PARSE_PARAMETERS_END();
10021002

10031003
if (!try_convert_to_string(number)) {
1004-
return;
1004+
RETURN_THROWS();
10051005
}
10061006

10071007
if (frombase < 2 || frombase > 36) {

ext/standard/pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ PHP_FUNCTION(pack)
298298
if (!try_convert_to_string(&argv[currentarg])) {
299299
efree(formatcodes);
300300
efree(formatargs);
301-
return;
301+
RETURN_THROWS();
302302
}
303303

304304
arg = Z_STRLEN(argv[currentarg]);

ext/standard/streamsfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ PHP_FUNCTION(stream_is_local)
15761576
wrapper = stream->wrapper;
15771577
} else {
15781578
if (!try_convert_to_string(zstream)) {
1579-
return;
1579+
RETURN_THROWS();
15801580
}
15811581

15821582
wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0);

ext/xml/xml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ PHP_FUNCTION(xml_parser_set_option)
15141514
case PHP_XML_OPTION_TARGET_ENCODING: {
15151515
const xml_encoding *enc;
15161516
if (!try_convert_to_string(val)) {
1517-
return;
1517+
RETURN_THROWS();
15181518
}
15191519

15201520
enc = xml_get_encoding((XML_Char*)Z_STRVAL_P(val));

0 commit comments

Comments
 (0)