@@ -24,7 +24,7 @@ PHP_FUNCTION(phar_opendir) /* {{{ */
24
24
{
25
25
char * filename ;
26
26
size_t filename_len ;
27
- zval * zcontext = NULL ;
27
+ php_stream_context * context = NULL ;
28
28
29
29
if (!PHAR_G (intercepted )) {
30
30
goto skip_phar ;
@@ -35,9 +35,11 @@ PHP_FUNCTION(phar_opendir) /* {{{ */
35
35
goto skip_phar ;
36
36
}
37
37
38
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "p|r!" , & filename , & filename_len , & zcontext ) == FAILURE ) {
39
- RETURN_THROWS ();
40
- }
38
+ ZEND_PARSE_PARAMETERS_START_EX (ZEND_PARSE_PARAMS_QUIET , 1 , 2 )
39
+ Z_PARAM_PATH (filename , filename_len )
40
+ Z_PARAM_OPTIONAL
41
+ PHP_Z_PARAM_STREAM_CONTEXT_OR_NULL_AS_DEFAULT_CONTEXT (context )
42
+ ZEND_PARSE_PARAMETERS_END_EX (goto skip_phar ;);
41
43
42
44
if (!IS_ABSOLUTE_PATH (filename , filename_len ) && !strstr (filename , "://" )) {
43
45
char * arch , * entry ;
@@ -51,7 +53,6 @@ PHP_FUNCTION(phar_opendir) /* {{{ */
51
53
}
52
54
53
55
if (SUCCESS == phar_split_fname (ZSTR_VAL (fname ), ZSTR_LEN (fname ), & arch , & arch_len , & entry , & entry_len , 2 , 0 )) {
54
- php_stream_context * context = NULL ;
55
56
php_stream * stream ;
56
57
char * name ;
57
58
@@ -69,9 +70,7 @@ PHP_FUNCTION(phar_opendir) /* {{{ */
69
70
}
70
71
efree (entry );
71
72
efree (arch );
72
- if (zcontext ) {
73
- context = php_stream_context_from_zval (zcontext , 0 );
74
- }
73
+
75
74
stream = php_stream_opendir (name , REPORT_ERRORS , context );
76
75
efree (name );
77
76
if (!stream ) {
@@ -163,7 +162,7 @@ PHP_FUNCTION(phar_file_get_contents) /* {{{ */
163
162
zend_long offset = -1 ;
164
163
zend_long maxlen ;
165
164
bool maxlen_is_null = 1 ;
166
- zval * zcontext = NULL ;
165
+ php_stream_context * context = NULL ;
167
166
168
167
if (!PHAR_G (intercepted )) {
169
168
goto skip_phar ;
@@ -175,9 +174,14 @@ PHP_FUNCTION(phar_file_get_contents) /* {{{ */
175
174
}
176
175
177
176
/* Parse arguments */
178
- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "P|br!ll!" , & filename , & use_include_path , & zcontext , & offset , & maxlen , & maxlen_is_null ) == FAILURE ) {
179
- goto skip_phar ;
180
- }
177
+ ZEND_PARSE_PARAMETERS_START_EX (ZEND_PARSE_PARAMS_QUIET , 1 , 5 )
178
+ Z_PARAM_PATH_STR (filename )
179
+ Z_PARAM_OPTIONAL
180
+ Z_PARAM_BOOL (use_include_path )
181
+ PHP_Z_PARAM_STREAM_CONTEXT_OR_NULL_AS_DEFAULT_CONTEXT (context )
182
+ Z_PARAM_LONG (offset )
183
+ Z_PARAM_LONG_OR_NULL (maxlen , maxlen_is_null )
184
+ ZEND_PARSE_PARAMETERS_END_EX (goto skip_phar ;);
181
185
182
186
if (maxlen_is_null ) {
183
187
maxlen = (ssize_t ) PHP_STREAM_COPY_ALL ;
@@ -192,13 +196,7 @@ PHP_FUNCTION(phar_file_get_contents) /* {{{ */
192
196
goto skip_phar ;
193
197
}
194
198
195
- php_stream_context * context = NULL ;
196
- php_stream * stream ;
197
-
198
- if (zcontext ) {
199
- context = php_stream_context_from_zval (zcontext , 0 );
200
- }
201
- stream = php_stream_open_wrapper_ex (ZSTR_VAL (name ), "rb" , 0 | REPORT_ERRORS , NULL , context );
199
+ php_stream * stream = php_stream_open_wrapper_ex (ZSTR_VAL (name ), "rb" , 0 | REPORT_ERRORS , NULL , context );
202
200
203
201
zend_string_release_ex (name , false);
204
202
@@ -236,7 +234,7 @@ PHP_FUNCTION(phar_readfile) /* {{{ */
236
234
{
237
235
zend_string * filename ;
238
236
bool use_include_path = 0 ;
239
- zval * zcontext = NULL ;
237
+ php_stream_context * context = NULL ;
240
238
241
239
if (!PHAR_G (intercepted )) {
242
240
goto skip_phar ;
@@ -246,19 +244,21 @@ PHP_FUNCTION(phar_readfile) /* {{{ */
246
244
&& !HT_IS_INITIALIZED (& cached_phars )) {
247
245
goto skip_phar ;
248
246
}
249
- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "P|br!" , & filename , & use_include_path , & zcontext ) == FAILURE ) {
250
- goto skip_phar ;
251
- }
247
+
248
+ ZEND_PARSE_PARAMETERS_START_EX (ZEND_PARSE_PARAMS_QUIET , 1 , 3 )
249
+ Z_PARAM_PATH_STR (filename )
250
+ Z_PARAM_OPTIONAL
251
+ Z_PARAM_BOOL (use_include_path )
252
+ PHP_Z_PARAM_STREAM_CONTEXT_OR_NULL_AS_DEFAULT_CONTEXT (context )
253
+ ZEND_PARSE_PARAMETERS_END_EX (goto skip_phar ;);
254
+
252
255
if (use_include_path || (!IS_ABSOLUTE_PATH (ZSTR_VAL (filename ), ZSTR_LEN (filename )) && !strstr (ZSTR_VAL (filename ), "://"))) {
253
256
zend_string * name = phar_get_name_for_relative_paths (filename , use_include_path );
254
257
if (!name ) {
255
258
goto skip_phar ;
256
259
}
257
260
258
- php_stream * stream ;
259
- php_stream_context * context = php_stream_context_from_zval (zcontext , 0 );
260
-
261
- stream = php_stream_open_wrapper_ex (ZSTR_VAL (name ), "rb" , 0 | REPORT_ERRORS , NULL , context );
261
+ php_stream * stream = php_stream_open_wrapper_ex (ZSTR_VAL (name ), "rb ", 0 | REPORT_ERRORS , NULL , context );
262
262
263
263
zend_string_release_ex (name , false );
264
264
if (stream == NULL) {
0 commit comments