Skip to content

Commit 7ec8eb3

Browse files
committed
Use resource directly
1 parent 38efb69 commit 7ec8eb3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

ext/standard/file.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ php_file_globals file_globals;
128128
/* }}} */
129129

130130
#define PHP_STREAM_TO_ZVAL(stream, arg) \
131-
php_stream_from_zval_no_verify(stream, arg); \
132-
if (stream == NULL) { \
133-
RETURN_FALSE; \
134-
}
131+
ZEND_ASSERT(Z_TYPE_P(arg) == IS_RESOURCE); \
132+
php_stream_from_res(stream, Z_RES_P(arg));
135133

136134
/* {{{ ZTS-stuff / Globals / Prototypes */
137135

main/php_streams.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ END_EXTERN_C()
265265
RETURN_FALSE; \
266266
} \
267267
} while (0)
268+
#define php_stream_from_res_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource((res), "stream", NULL, php_file_le_stream(), php_file_le_pstream())
268269
#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), "stream", NULL, php_file_le_stream(), php_file_le_pstream())
269270

270271
BEGIN_EXTERN_C()

0 commit comments

Comments
 (0)