Skip to content

Commit 2244810

Browse files
committed
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.
1 parent 9084907 commit 2244810

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main/php_streams.h

+4
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ END_EXTERN_C()
285285
#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())
286286
#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())
287287

288+
static zend_always_inline php_stream* php_stream_from_zval_no_verify_no_error(zval *zval) {
289+
return (php_stream*)zend_fetch_resource2_ex(zval, NULL, php_file_le_stream(), php_file_le_pstream());
290+
}
291+
288292
BEGIN_EXTERN_C()
289293

290294
static zend_always_inline bool php_stream_zend_parse_arg_into_stream(

0 commit comments

Comments
 (0)