@@ -146,10 +146,10 @@ static void build_runtime_defined_function_key(zval *result, const char *name, z
146
146
}
147
147
148
148
/* NULL, name length, filename length, last accepting char position length */
149
- Z_STRLEN_P (result ) = 1 + name_length + strlen (filename )+ char_pos_len ;
149
+ Z_STRSIZE_P (result ) = 1 + name_length + strlen (filename )+ char_pos_len ;
150
150
151
151
/* must be binary safe */
152
- Z_STRVAL_P (result ) = (char * ) safe_emalloc (Z_STRLEN_P (result ), 1 , 1 );
152
+ Z_STRVAL_P (result ) = (char * ) safe_emalloc (Z_STRSIZE_P (result ), 1 , 1 );
153
153
Z_STRVAL_P (result )[0 ] = '\0' ;
154
154
sprintf (Z_STRVAL_P (result )+ 1 , "%s%s%s" , name , filename , char_pos_buf );
155
155
@@ -656,14 +656,14 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar
656
656
convert_to_string (& varname -> u .constant );
657
657
}
658
658
659
- hash = str_hash (Z_STRVAL (varname -> u .constant ), Z_STRLEN (varname -> u .constant ));
660
- if (!zend_is_auto_global_quick (Z_STRVAL (varname -> u .constant ), Z_STRLEN (varname -> u .constant ), hash TSRMLS_CC ) &&
661
- !(Z_STRLEN (varname -> u .constant ) == (sizeof ("this" )- 1 ) &&
659
+ hash = str_hash (Z_STRVAL (varname -> u .constant ), Z_STRSIZE (varname -> u .constant ));
660
+ if (!zend_is_auto_global_quick (Z_STRVAL (varname -> u .constant ), Z_STRSIZE (varname -> u .constant ), hash TSRMLS_CC ) &&
661
+ !(Z_STRSIZE (varname -> u .constant ) == (sizeof ("this" )- 1 ) &&
662
662
!memcmp (Z_STRVAL (varname -> u .constant ), "this" , sizeof ("this" ))) &&
663
663
(CG (active_op_array )-> last == 0 ||
664
664
CG (active_op_array )-> opcodes [CG (active_op_array )-> last - 1 ].opcode != ZEND_BEGIN_SILENCE )) {
665
665
result -> op_type = IS_CV ;
666
- result -> u .op .var = lookup_cv (CG (active_op_array ), Z_STRVAL (varname -> u .constant ), Z_STRLEN (varname -> u .constant ), hash TSRMLS_CC );
666
+ result -> u .op .var = lookup_cv (CG (active_op_array ), Z_STRVAL (varname -> u .constant ), Z_STRSIZE (varname -> u .constant ), hash TSRMLS_CC );
667
667
Z_STRVAL (varname -> u .constant ) = (char * )CG (active_op_array )-> vars [result -> u .op .var ].name ;
668
668
result -> EA = 0 ;
669
669
return ;
@@ -687,7 +687,7 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar
687
687
688
688
if (varname -> op_type == IS_CONST ) {
689
689
CALCULATE_LITERAL_HASH (opline_ptr -> op1 .constant );
690
- if (zend_is_auto_global_quick (Z_STRVAL (varname -> u .constant ), Z_STRLEN (varname -> u .constant ), Z_HASH_P (& CONSTANT (opline_ptr -> op1 .constant )) TSRMLS_CC )) {
690
+ if (zend_is_auto_global_quick (Z_STRVAL (varname -> u .constant ), Z_STRSIZE (varname -> u .constant ), Z_HASH_P (& CONSTANT (opline_ptr -> op1 .constant )) TSRMLS_CC )) {
691
691
opline_ptr -> extended_value = ZEND_FETCH_GLOBAL ;
692
692
}
693
693
}
@@ -1520,7 +1520,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
1520
1520
{
1521
1521
zend_op_array op_array ;
1522
1522
char * name = Z_STRVAL (function_name -> u .constant );
1523
- zend_str_size_int name_len = Z_STRLEN (function_name -> u .constant );
1523
+ zend_str_size_int name_len = Z_STRSIZE (function_name -> u .constant );
1524
1524
zend_str_size_int function_begin_line = function_token -> u .op .opline_num ;
1525
1525
zend_uint fn_flags ;
1526
1526
const char * lcname ;
@@ -1831,7 +1831,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
1831
1831
zend_error (E_COMPILE_ERROR , "Cannot re-assign auto-global variable %s" , Z_STRVAL (varname -> u .constant ));
1832
1832
} else {
1833
1833
var .op_type = IS_CV ;
1834
- var .u .op .var = lookup_cv (CG (active_op_array ), Z_STRVAL (varname -> u .constant ), Z_STRLEN (varname -> u .constant ), 0 TSRMLS_CC );
1834
+ var .u .op .var = lookup_cv (CG (active_op_array ), Z_STRVAL (varname -> u .constant ), Z_STRSIZE (varname -> u .constant ), 0 TSRMLS_CC );
1835
1835
Z_STRVAL (varname -> u .constant ) = (char * )CG (active_op_array )-> vars [var .u .op .var ].name ;
1836
1836
var .EA = 0 ;
1837
1837
if (CG (active_op_array )-> vars [var .u .op .var ].hash_value == THIS_HASHVAL &&
@@ -1874,8 +1874,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
1874
1874
}
1875
1875
CG (active_op_array )-> arg_info = erealloc (CG (active_op_array )-> arg_info , sizeof (zend_arg_info )* (CG (active_op_array )-> num_args ));
1876
1876
cur_arg_info = & CG (active_op_array )-> arg_info [CG (active_op_array )-> num_args - 1 ];
1877
- cur_arg_info -> name = zend_new_interned_string (estrndup (Z_STRVAL (varname -> u .constant ), Z_STRLEN (varname -> u .constant )), Z_STRLEN (varname -> u .constant ) + 1 , 1 TSRMLS_CC );
1878
- cur_arg_info -> name_len = Z_STRLEN (varname -> u .constant );
1877
+ cur_arg_info -> name = zend_new_interned_string (estrndup (Z_STRVAL (varname -> u .constant ), Z_STRSIZE (varname -> u .constant )), Z_STRSIZE (varname -> u .constant ) + 1 , 1 TSRMLS_CC );
1878
+ cur_arg_info -> name_len = Z_STRSIZE (varname -> u .constant );
1879
1879
cur_arg_info -> type_hint = 0 ;
1880
1880
cur_arg_info -> pass_by_reference = pass_by_reference ;
1881
1881
cur_arg_info -> allow_null = 1 ;
@@ -1910,9 +1910,9 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
1910
1910
if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type (Z_STRVAL (class_type -> u .constant ), Z_STRSIZE (class_type -> u .constant ))) {
1911
1911
zend_resolve_class_name (class_type TSRMLS_CC );
1912
1912
}
1913
- Z_STRVAL (class_type -> u .constant ) = (char * )zend_new_interned_string (Z_STRVAL (class_type -> u .constant ), Z_STRLEN (class_type -> u .constant ) + 1 , 1 TSRMLS_CC );
1913
+ Z_STRVAL (class_type -> u .constant ) = (char * )zend_new_interned_string (Z_STRVAL (class_type -> u .constant ), Z_STRSIZE (class_type -> u .constant ) + 1 , 1 TSRMLS_CC );
1914
1914
cur_arg_info -> class_name = Z_STRVAL (class_type -> u .constant );
1915
- cur_arg_info -> class_name_len = Z_STRLEN (class_type -> u .constant );
1915
+ cur_arg_info -> class_name_len = Z_STRSIZE (class_type -> u .constant );
1916
1916
if (op == ZEND_RECV_INIT ) {
1917
1917
if (Z_TYPE (initialization -> u .constant ) == IS_NULL || (Z_TYPE (initialization -> u .constant ) == IS_CONSTANT && !strcasecmp (Z_STRVAL (initialization -> u .constant ), "NULL" ))) {
1918
1918
cur_arg_info -> allow_null = 1 ;
@@ -1944,8 +1944,8 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace
1944
1944
return 1 ;
1945
1945
}
1946
1946
1947
- lcname = zend_str_tolower_dup (Z_STRVAL (function_name -> u .constant ), Z_STRLEN (function_name -> u .constant ));
1948
- if ((zend_hash_find (CG (function_table ), lcname , Z_STRLEN (function_name -> u .constant )+ 1 , (void * * ) & function )== FAILURE ) ||
1947
+ lcname = zend_str_tolower_dup (Z_STRVAL (function_name -> u .constant ), Z_STRSIZE (function_name -> u .constant ));
1948
+ if ((zend_hash_find (CG (function_table ), lcname , Z_STRSIZE (function_name -> u .constant )+ 1 , (void * * ) & function )== FAILURE ) ||
1949
1949
((CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ) &&
1950
1950
(function -> type == ZEND_INTERNAL_FUNCTION ))) {
1951
1951
zend_do_begin_dynamic_function_call (function_name , 0 TSRMLS_CC );
@@ -2126,7 +2126,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
2126
2126
int lctype ;
2127
2127
znode constant_name ;
2128
2128
2129
- lcname = zend_str_tolower_dup (Z_STRVAL (class_name -> u .constant ), Z_STRLEN (class_name -> u .constant ));
2129
+ lcname = zend_str_tolower_dup (Z_STRVAL (class_name -> u .constant ), Z_STRSIZE (class_name -> u .constant ));
2130
2130
lctype = zend_get_class_fetch_type (lcname , strlen (lcname ));
2131
2131
switch (lctype ) {
2132
2132
case ZEND_FETCH_CLASS_SELF :
@@ -2256,7 +2256,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */
2256
2256
if (class_name -> op_type == IS_CONST ) {
2257
2257
int fetch_type ;
2258
2258
2259
- fetch_type = zend_get_class_fetch_type (Z_STRVAL (class_name -> u .constant ), Z_STRLEN (class_name -> u .constant ));
2259
+ fetch_type = zend_get_class_fetch_type (Z_STRVAL (class_name -> u .constant ), Z_STRSIZE (class_name -> u .constant ));
2260
2260
switch (fetch_type ) {
2261
2261
case ZEND_FETCH_CLASS_SELF :
2262
2262
case ZEND_FETCH_CLASS_PARENT :
@@ -2403,19 +2403,19 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c
2403
2403
}
2404
2404
2405
2405
if (is_class_member ) {
2406
- length = sizeof ("::" )- 1 + Z_STRLEN (result -> u .constant ) + Z_STRLEN (name -> u .constant );
2406
+ length = sizeof ("::" )- 1 + Z_STRSIZE (result -> u .constant ) + Z_STRSIZE (name -> u .constant );
2407
2407
Z_STRVAL (result -> u .constant ) = erealloc (Z_STRVAL (result -> u .constant ), length + 1 );
2408
- memcpy (& Z_STRVAL (result -> u .constant )[Z_STRLEN (result -> u .constant )], "::" , sizeof ("::" )- 1 );
2409
- memcpy (& Z_STRVAL (result -> u .constant )[Z_STRLEN (result -> u .constant ) + sizeof ("::" )- 1 ], Z_STRVAL (name -> u .constant ), Z_STRLEN (name -> u .constant )+ 1 );
2408
+ memcpy (& Z_STRVAL (result -> u .constant )[Z_STRSIZE (result -> u .constant )], "::" , sizeof ("::" )- 1 );
2409
+ memcpy (& Z_STRVAL (result -> u .constant )[Z_STRSIZE (result -> u .constant ) + sizeof ("::" )- 1 ], Z_STRVAL (name -> u .constant ), Z_STRSIZE (name -> u .constant )+ 1 );
2410
2410
str_efree (Z_STRVAL (name -> u .constant ));
2411
- Z_STRLEN (result -> u .constant ) = length ;
2411
+ Z_STRSIZE (result -> u .constant ) = length ;
2412
2412
} else {
2413
- length = sizeof ("\\" )- 1 + Z_STRLEN (result -> u .constant ) + Z_STRLEN (name -> u .constant );
2413
+ length = sizeof ("\\" )- 1 + Z_STRSIZE (result -> u .constant ) + Z_STRSIZE (name -> u .constant );
2414
2414
Z_STRVAL (result -> u .constant ) = erealloc (Z_STRVAL (result -> u .constant ), length + 1 );
2415
- memcpy (& Z_STRVAL (result -> u .constant )[Z_STRLEN (result -> u .constant )], "\\" , sizeof ("\\" )- 1 );
2416
- memcpy (& Z_STRVAL (result -> u .constant )[Z_STRLEN (result -> u .constant ) + sizeof ("\\" )- 1 ], Z_STRVAL (name -> u .constant ), Z_STRLEN (name -> u .constant )+ 1 );
2415
+ memcpy (& Z_STRVAL (result -> u .constant )[Z_STRSIZE (result -> u .constant )], "\\" , sizeof ("\\" )- 1 );
2416
+ memcpy (& Z_STRVAL (result -> u .constant )[Z_STRSIZE (result -> u .constant ) + sizeof ("\\" )- 1 ], Z_STRVAL (name -> u .constant ), Z_STRSIZE (name -> u .constant )+ 1 );
2417
2417
str_efree (Z_STRVAL (name -> u .constant ));
2418
- Z_STRLEN (result -> u .constant ) = length ;
2418
+ Z_STRSIZE (result -> u .constant ) = length ;
2419
2419
}
2420
2420
}
2421
2421
/* }}} */
@@ -2886,7 +2886,7 @@ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var
2886
2886
opline -> op1_type = IS_CONST ;
2887
2887
opline -> op1 .constant = zend_add_class_name_literal (CG (active_op_array ), & catch_class .u .constant TSRMLS_CC );
2888
2888
opline -> op2_type = IS_CV ;
2889
- opline -> op2 .var = lookup_cv (CG (active_op_array ), Z_STRVAL (catch_var -> u .constant ), Z_STRLEN (catch_var -> u .constant ), 0 TSRMLS_CC );
2889
+ opline -> op2 .var = lookup_cv (CG (active_op_array ), Z_STRVAL (catch_var -> u .constant ), Z_STRSIZE (catch_var -> u .constant ), 0 TSRMLS_CC );
2890
2890
Z_STRVAL (catch_var -> u .constant ) = (char * )CG (active_op_array )-> vars [opline -> op2 .var ].name ;
2891
2891
opline -> result .num = 0 ; /* 1 means it's the last catch in the block */
2892
2892
@@ -4965,7 +4965,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
4965
4965
return ;
4966
4966
}
4967
4967
4968
- lcname = zend_str_tolower_dup (Z_STRVAL (class_name -> u .constant ), Z_STRLEN (class_name -> u .constant ));
4968
+ lcname = zend_str_tolower_dup (Z_STRVAL (class_name -> u .constant ), Z_STRSIZE (class_name -> u .constant ));
4969
4969
4970
4970
if (!(strcmp (lcname , "self" ) && strcmp (lcname , "parent" ))) {
4971
4971
efree (lcname );
@@ -5287,7 +5287,7 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui
5287
5287
CG (active_class_entry )-> name , Z_STRVAL (var_name -> u .constant ));
5288
5288
}
5289
5289
5290
- if (zend_hash_find (& CG (active_class_entry )-> properties_info , Z_STRVAL (var_name -> u .constant ), Z_STRLEN (var_name -> u .constant )+ 1 , (void * * ) & existing_property_info )== SUCCESS ) {
5290
+ if (zend_hash_find (& CG (active_class_entry )-> properties_info , Z_STRVAL (var_name -> u .constant ), Z_STRSIZE (var_name -> u .constant )+ 1 , (void * * ) & existing_property_info )== SUCCESS ) {
5291
5291
zend_error (E_COMPILE_ERROR , "Cannot redeclare %s::$%s" , CG (active_class_entry )-> name , Z_STRVAL (var_name -> u .constant ));
5292
5292
}
5293
5293
ALLOC_ZVAL (property );
@@ -5306,7 +5306,7 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui
5306
5306
CG (doc_comment_len ) = 0 ;
5307
5307
}
5308
5308
5309
- zend_declare_property_ex (CG (active_class_entry ), zend_new_interned_string (Z_STRVAL (var_name -> u .constant ), Z_STRLEN (var_name -> u .constant ) + 1 , 0 TSRMLS_CC ), Z_STRLEN (var_name -> u .constant ), property , access_type , comment , comment_len TSRMLS_CC );
5309
+ zend_declare_property_ex (CG (active_class_entry ), zend_new_interned_string (Z_STRVAL (var_name -> u .constant ), Z_STRSIZE (var_name -> u .constant ) + 1 , 0 TSRMLS_CC ), Z_STRSIZE (var_name -> u .constant ), property , access_type , comment , comment_len TSRMLS_CC );
5310
5310
efree (Z_STRVAL (var_name -> u .constant ));
5311
5311
}
5312
5312
/* }}} */
@@ -5329,9 +5329,9 @@ void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_D
5329
5329
ALLOC_ZVAL (property );
5330
5330
* property = value -> u .constant ;
5331
5331
5332
- cname = zend_new_interned_string (Z_STRVAL (var_name -> u .constant ), Z_STRLEN (var_name -> u .constant )+ 1 , 0 TSRMLS_CC );
5333
- hash = str_hash (cname , Z_STRLEN (var_name -> u .constant ));
5334
- if (zend_hash_quick_add (& CG (active_class_entry )-> constants_table , cname , Z_STRLEN (var_name -> u .constant )+ 1 , hash , & property , sizeof (zval * ), NULL ) == FAILURE ) {
5332
+ cname = zend_new_interned_string (Z_STRVAL (var_name -> u .constant ), Z_STRSIZE (var_name -> u .constant )+ 1 , 0 TSRMLS_CC );
5333
+ hash = str_hash (cname , Z_STRSIZE (var_name -> u .constant ));
5334
+ if (zend_hash_quick_add (& CG (active_class_entry )-> constants_table , cname , Z_STRSIZE (var_name -> u .constant )+ 1 , hash , & property , sizeof (zval * ), NULL ) == FAILURE ) {
5335
5335
FREE_ZVAL (property );
5336
5336
zend_error (E_COMPILE_ERROR , "Cannot redefine class constant %s::%s" , CG (active_class_entry )-> name , Z_STRVAL (var_name -> u .constant ));
5337
5337
}
@@ -5782,7 +5782,7 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode
5782
5782
zval_dtor (& offset -> u .constant );
5783
5783
break ;
5784
5784
case IS_STRING :
5785
- zend_symtable_update (Z_ARRVAL (result -> u .constant ), Z_STRVAL (offset -> u .constant ), Z_STRLEN (offset -> u .constant )+ 1 , & element , sizeof (zval * ), NULL );
5785
+ zend_symtable_update (Z_ARRVAL (result -> u .constant ), Z_STRVAL (offset -> u .constant ), Z_STRSIZE (offset -> u .constant )+ 1 , & element , sizeof (zval * ), NULL );
5786
5786
zval_dtor (& offset -> u .constant );
5787
5787
break ;
5788
5788
case IS_NULL :
@@ -5959,7 +5959,7 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen
5959
5959
ALLOC_HASHTABLE (CG (active_op_array )-> static_variables );
5960
5960
zend_hash_init (CG (active_op_array )-> static_variables , 2 , NULL , ZVAL_PTR_DTOR , 0 );
5961
5961
}
5962
- zend_hash_update (CG (active_op_array )-> static_variables , Z_STRVAL (varname -> u .constant ), Z_STRLEN (varname -> u .constant )+ 1 , & tmp , sizeof (zval * ), NULL );
5962
+ zend_hash_update (CG (active_op_array )-> static_variables , Z_STRVAL (varname -> u .constant ), Z_STRSIZE (varname -> u .constant )+ 1 , & tmp , sizeof (zval * ), NULL );
5963
5963
5964
5964
if (varname -> op_type == IS_CONST ) {
5965
5965
if (Z_TYPE (varname -> u .constant ) != IS_STRING ) {
@@ -6385,10 +6385,10 @@ void zend_do_declare_begin(TSRMLS_D) /* {{{ */
6385
6385
6386
6386
void zend_do_declare_stmt (znode * var , znode * val TSRMLS_DC ) /* {{{ */
6387
6387
{
6388
- if (!zend_binary_strcasecmp (Z_STRVAL (var -> u .constant ), Z_STRLEN (var -> u .constant ), "ticks" , sizeof ("ticks" )- 1 )) {
6388
+ if (!zend_binary_strcasecmp (Z_STRVAL (var -> u .constant ), Z_STRSIZE (var -> u .constant ), "ticks" , sizeof ("ticks" )- 1 )) {
6389
6389
convert_to_long (& val -> u .constant );
6390
6390
CG (declarables ).ticks = val -> u .constant ;
6391
- } else if (!zend_binary_strcasecmp (Z_STRVAL (var -> u .constant ), Z_STRLEN (var -> u .constant ), "encoding" , sizeof ("encoding" )- 1 )) {
6391
+ } else if (!zend_binary_strcasecmp (Z_STRVAL (var -> u .constant ), Z_STRSIZE (var -> u .constant ), "encoding" , sizeof ("encoding" )- 1 )) {
6392
6392
if ((Z_TYPE (val -> u .constant ) & IS_CONSTANT_TYPE_MASK ) == IS_CONSTANT ) {
6393
6393
zend_error (E_COMPILE_ERROR , "Cannot use constants as encoding" );
6394
6394
}
0 commit comments