Skip to content

Commit 45b638a

Browse files
committed
php_formatted_print() throws on failure
Closes GH-6542.
1 parent 57430e6 commit 45b638a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/standard/formatted_print.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ PHP_FUNCTION(sprintf)
770770

771771
result = php_formatted_print(format, format_len, args, argc, 1);
772772
if (result == NULL) {
773-
return;
773+
RETURN_THROWS();
774774
}
775775
RETVAL_STR(result);
776776
}
@@ -796,7 +796,7 @@ PHP_FUNCTION(vsprintf)
796796
result = php_formatted_print(format, format_len, args, argc, -1);
797797
efree(args);
798798
if (result == NULL) {
799-
return;
799+
RETURN_THROWS();
800800
}
801801
RETVAL_STR(result);
802802
}
@@ -819,7 +819,7 @@ PHP_FUNCTION(printf)
819819

820820
result = php_formatted_print(format, format_len, args, argc, 1);
821821
if (result == NULL) {
822-
return;
822+
RETURN_THROWS();
823823
}
824824
rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result));
825825
zend_string_efree(result);
@@ -848,7 +848,7 @@ PHP_FUNCTION(vprintf)
848848
result = php_formatted_print(format, format_len, args, argc, -1);
849849
efree(args);
850850
if (result == NULL) {
851-
return;
851+
RETURN_THROWS();
852852
}
853853
rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result));
854854
zend_string_efree(result);
@@ -876,7 +876,7 @@ PHP_FUNCTION(fprintf)
876876

877877
result = php_formatted_print(format, format_len, args, argc, 2);
878878
if (result == NULL) {
879-
return;
879+
RETURN_THROWS();
880880
}
881881

882882
php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result));
@@ -910,7 +910,7 @@ PHP_FUNCTION(vfprintf)
910910
result = php_formatted_print(format, format_len, args, argc, -1);
911911
efree(args);
912912
if (result == NULL) {
913-
return;
913+
RETURN_THROWS();
914914
}
915915

916916
php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result));

0 commit comments

Comments
 (0)