From da1fde28f3ef2ae4cb07587203f7363229370d56 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 3 Mar 2025 15:57:44 +0000 Subject: [PATCH] ext/standard: Use new php_streams fast ZPP specifier --- ext/standard/formatted_print.c | 14 +++++--------- ext/standard/user_filters.c | 5 ++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 8d8c09f443c..9471ad3c7ba 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -860,18 +860,16 @@ PHP_FUNCTION(fprintf) php_stream *stream; char *format; size_t format_len; - zval *arg1, *args; - int argc; + zval *args = NULL; + int argc = 0; zend_string *result; ZEND_PARSE_PARAMETERS_START(2, -1) - Z_PARAM_RESOURCE(arg1) + PHP_Z_PARAM_STREAM(stream) Z_PARAM_STRING(format, format_len) Z_PARAM_VARIADIC('*', args, argc) ZEND_PARSE_PARAMETERS_END(); - php_stream_from_zval(stream, arg1); - result = php_formatted_print(format, format_len, args, argc, 2); if (result == NULL) { RETURN_THROWS(); @@ -890,19 +888,17 @@ PHP_FUNCTION(vfprintf) php_stream *stream; char *format; size_t format_len; - zval *arg1, *args; + zval *args; zend_array *array; int argc; zend_string *result; ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_RESOURCE(arg1) + PHP_Z_PARAM_STREAM(stream) Z_PARAM_STRING(format, format_len) Z_PARAM_ARRAY_HT(array) ZEND_PARSE_PARAMETERS_END(); - php_stream_from_zval(stream, arg1); - args = php_formatted_print_get_array(array, &argc); result = php_formatted_print(format, format_len, args, argc, -1); diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 2168fbce0af..88facf1e137 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -439,7 +439,7 @@ PHP_FUNCTION(stream_bucket_append) /* {{{ Create a new bucket for use on the current stream */ PHP_FUNCTION(stream_bucket_new) { - zval *zstream, zbucket; + zval zbucket; php_stream *stream; char *buffer; char *pbuffer; @@ -447,11 +447,10 @@ PHP_FUNCTION(stream_bucket_new) php_stream_bucket *bucket; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ZVAL(zstream) + PHP_Z_PARAM_STREAM(stream) Z_PARAM_STRING(buffer, buffer_len) ZEND_PARSE_PARAMETERS_END(); - php_stream_from_zval(stream, zstream); pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream)); memcpy(pbuffer, buffer, buffer_len);