main/streams: Add a new helper function to get a php_stream from a zval without errors

This is intended to replace the few manual usages of zend_fetch_resource2_ex() to fetch a php_stream from a zval.
This will simplify the conversion from resource to object for streams when this actually happens.
This commit is contained in:
Gina Peter Banyard 2025-03-17 14:29:41 +00:00
parent 908490764b
commit 2244810dcf

View file

@ -285,6 +285,10 @@ END_EXTERN_C()
#define php_stream_from_res_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2((res), "stream", php_file_le_stream(), php_file_le_pstream())
#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), "stream", php_file_le_stream(), php_file_le_pstream())
static zend_always_inline php_stream* php_stream_from_zval_no_verify_no_error(zval *zval) {
return (php_stream*)zend_fetch_resource2_ex(zval, NULL, php_file_le_stream(), php_file_le_pstream());
}
BEGIN_EXTERN_C()
static zend_always_inline bool php_stream_zend_parse_arg_into_stream(