From: Christoph M. Becker Date: Sun, 6 Dec 2020 15:02:57 +0000 (+0100) Subject: Clarify and assert that printf() and friends never return NULL X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9f3cf89f3fe9ec0c59df202902db508008351fe;p=php Clarify and assert that printf() and friends never return NULL Closes GH-6491. --- diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 9bb4a5cb06..ab205feb6f 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -770,7 +770,7 @@ PHP_FUNCTION(sprintf) result = php_formatted_print(format, format_len, args, argc, 1); if (result == NULL) { - return; + RETURN_THROWS(); } RETVAL_STR(result); } @@ -796,7 +796,7 @@ PHP_FUNCTION(vsprintf) result = php_formatted_print(format, format_len, args, argc, -1); efree(args); if (result == NULL) { - return; + RETURN_THROWS(); } RETVAL_STR(result); } @@ -819,7 +819,7 @@ PHP_FUNCTION(printf) result = php_formatted_print(format, format_len, args, argc, 1); if (result == NULL) { - return; + RETURN_THROWS(); } rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result)); zend_string_efree(result); @@ -848,7 +848,7 @@ PHP_FUNCTION(vprintf) result = php_formatted_print(format, format_len, args, argc, -1); efree(args); if (result == NULL) { - return; + RETURN_THROWS(); } rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result)); zend_string_efree(result); @@ -876,7 +876,7 @@ PHP_FUNCTION(fprintf) result = php_formatted_print(format, format_len, args, argc, 2); if (result == NULL) { - return; + RETURN_THROWS(); } php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result)); @@ -910,7 +910,7 @@ PHP_FUNCTION(vfprintf) result = php_formatted_print(format, format_len, args, argc, -1); efree(args); if (result == NULL) { - return; + RETURN_THROWS(); } php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result));