@@ -39,9 +39,9 @@ PHP_FUNCTION(grapheme_strlen)
39
39
zend_long ret_len ;
40
40
UErrorCode status ;
41
41
42
- if ( zend_parse_parameters ( ZEND_NUM_ARGS (), "s" , & string , & string_len ) == FAILURE ) {
43
- RETURN_THROWS ();
44
- }
42
+ ZEND_PARSE_PARAMETERS_START ( 1 , 1 )
43
+ Z_PARAM_STRING ( string , string_len )
44
+ ZEND_PARSE_PARAMETERS_END ();
45
45
46
46
ret_len = grapheme_ascii_check ((unsigned char * )string , string_len );
47
47
@@ -89,9 +89,12 @@ PHP_FUNCTION(grapheme_strpos)
89
89
size_t noffset = 0 ;
90
90
zend_long ret_pos ;
91
91
92
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "ss|l" , & haystack , & haystack_len , & needle , & needle_len , & loffset ) == FAILURE ) {
93
- RETURN_THROWS ();
94
- }
92
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
93
+ Z_PARAM_STRING (haystack , haystack_len )
94
+ Z_PARAM_STRING (needle , needle_len )
95
+ Z_PARAM_OPTIONAL
96
+ Z_PARAM_LONG (loffset )
97
+ ZEND_PARSE_PARAMETERS_END ();
95
98
96
99
if ( OUTSIDE_STRING (loffset , haystack_len ) ) {
97
100
zend_argument_value_error (3 , "must be contained in argument #1 ($haystack)" );
@@ -139,9 +142,12 @@ PHP_FUNCTION(grapheme_stripos)
139
142
zend_long ret_pos ;
140
143
int is_ascii ;
141
144
142
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "ss|l" , & haystack , & haystack_len , & needle , & needle_len , & loffset ) == FAILURE ) {
143
- RETURN_THROWS ();
144
- }
145
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
146
+ Z_PARAM_STRING (haystack , haystack_len )
147
+ Z_PARAM_STRING (needle , needle_len )
148
+ Z_PARAM_OPTIONAL
149
+ Z_PARAM_LONG (loffset )
150
+ ZEND_PARSE_PARAMETERS_END ();
145
151
146
152
if ( OUTSIDE_STRING (loffset , haystack_len ) ) {
147
153
zend_argument_value_error (3 , "must be contained in argument #1 ($haystack)" );
@@ -200,9 +206,12 @@ PHP_FUNCTION(grapheme_strrpos)
200
206
zend_long ret_pos ;
201
207
int is_ascii ;
202
208
203
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "ss|l" , & haystack , & haystack_len , & needle , & needle_len , & loffset ) == FAILURE ) {
204
- RETURN_THROWS ();
205
- }
209
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
210
+ Z_PARAM_STRING (haystack , haystack_len )
211
+ Z_PARAM_STRING (needle , needle_len )
212
+ Z_PARAM_OPTIONAL
213
+ Z_PARAM_LONG (loffset )
214
+ ZEND_PARSE_PARAMETERS_END ();
206
215
207
216
if ( OUTSIDE_STRING (loffset , haystack_len ) ) {
208
217
zend_argument_value_error (3 , "must be contained in argument #1 ($haystack)" );
@@ -255,9 +264,12 @@ PHP_FUNCTION(grapheme_strripos)
255
264
zend_long ret_pos ;
256
265
int is_ascii ;
257
266
258
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "ss|l" , & haystack , & haystack_len , & needle , & needle_len , & loffset ) == FAILURE ) {
259
- RETURN_THROWS ();
260
- }
267
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
268
+ Z_PARAM_STRING (haystack , haystack_len )
269
+ Z_PARAM_STRING (needle , needle_len )
270
+ Z_PARAM_OPTIONAL
271
+ Z_PARAM_LONG (loffset )
272
+ ZEND_PARSE_PARAMETERS_END ();
261
273
262
274
if ( OUTSIDE_STRING (loffset , haystack_len ) ) {
263
275
zend_argument_value_error (3 , "must be contained in argument #1 ($haystack)" );
@@ -325,11 +337,14 @@ PHP_FUNCTION(grapheme_substr)
325
337
UBreakIterator * bi = NULL ;
326
338
int sub_str_start_pos , sub_str_end_pos ;
327
339
int32_t (* iter_func )(UBreakIterator * );
328
- bool no_length = 1 ;
340
+ bool no_length = true ;
329
341
330
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "sl|l!" , & str , & str_len , & lstart , & length , & no_length ) == FAILURE ) {
331
- RETURN_THROWS ();
332
- }
342
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
343
+ Z_PARAM_STRING (str , str_len )
344
+ Z_PARAM_LONG (lstart )
345
+ Z_PARAM_OPTIONAL
346
+ Z_PARAM_LONG_OR_NULL (length , no_length )
347
+ ZEND_PARSE_PARAMETERS_END ();
333
348
334
349
if (lstart < INT32_MIN || lstart > INT32_MAX ) {
335
350
zend_argument_value_error (2 , "is too large" );
@@ -526,11 +541,14 @@ static void strstr_common_handler(INTERNAL_FUNCTION_PARAMETERS, int f_ignore_cas
526
541
const char * found ;
527
542
size_t haystack_len , needle_len ;
528
543
int32_t ret_pos , uchar_pos ;
529
- bool part = 0 ;
544
+ bool part = false ;
530
545
531
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "ss|b" , & haystack , & haystack_len , & needle , & needle_len , & part ) == FAILURE ) {
532
- RETURN_THROWS ();
533
- }
546
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
547
+ Z_PARAM_STRING (haystack , haystack_len )
548
+ Z_PARAM_STRING (needle , needle_len )
549
+ Z_PARAM_OPTIONAL
550
+ Z_PARAM_BOOL (part )
551
+ ZEND_PARSE_PARAMETERS_END ();
534
552
535
553
if ( !f_ignore_case ) {
536
554
@@ -702,9 +720,14 @@ PHP_FUNCTION(grapheme_extract)
702
720
int ret_pos ;
703
721
zval * next = NULL ; /* return offset of next part of the string */
704
722
705
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "sl|llz" , & str , & str_len , & size , & extract_type , & lstart , & next ) == FAILURE ) {
706
- RETURN_THROWS ();
707
- }
723
+ ZEND_PARSE_PARAMETERS_START (2 , 5 )
724
+ Z_PARAM_STRING (str , str_len )
725
+ Z_PARAM_LONG (size )
726
+ Z_PARAM_OPTIONAL
727
+ Z_PARAM_LONG (extract_type )
728
+ Z_PARAM_LONG (lstart )
729
+ Z_PARAM_ZVAL (next )
730
+ ZEND_PARSE_PARAMETERS_END ();
708
731
709
732
if (lstart < 0 ) {
710
733
lstart += str_len ;
0 commit comments