@@ -1248,7 +1248,7 @@ static inline void last_modified(void)
1248
1248
}
1249
1249
1250
1250
#define LAST_MODIFIED "Last-Modified: "
1251
- memcpy (buf , LAST_MODIFIED , sizeof (LAST_MODIFIED ) - 1 );
1251
+ memcpy (buf , ZEND_STRL (LAST_MODIFIED ));
1252
1252
strcpy_gmt (buf + sizeof (LAST_MODIFIED ) - 1 , & sb .st_mtime );
1253
1253
ADD_HEADER (buf );
1254
1254
}
@@ -1263,7 +1263,7 @@ CACHE_LIMITER_FUNC(public)
1263
1263
1264
1264
gettimeofday (& tv , NULL );
1265
1265
now = tv .tv_sec + PS (cache_expire ) * 60 ;
1266
- memcpy (buf , EXPIRES , sizeof (EXPIRES ) - 1 );
1266
+ memcpy (buf , ZEND_STRL (EXPIRES ));
1267
1267
strcpy_gmt (buf + sizeof (EXPIRES ) - 1 , & now );
1268
1268
ADD_HEADER (buf );
1269
1269
@@ -1394,7 +1394,7 @@ static zend_result php_session_send_cookie(void)
1394
1394
/* URL encode id because it might be user supplied */
1395
1395
e_id = php_url_encode (ZSTR_VAL (PS (id )), ZSTR_LEN (PS (id )));
1396
1396
1397
- smart_str_appendl (& ncookie , "Set-Cookie: " , sizeof ( "Set-Cookie: " ) - 1 );
1397
+ smart_str_appends (& ncookie , "Set-Cookie: " );
1398
1398
smart_str_appendl (& ncookie , PS (session_name ), strlen (PS (session_name )));
1399
1399
smart_str_appendc (& ncookie , '=' );
1400
1400
smart_str_append (& ncookie , e_id );
@@ -1409,7 +1409,7 @@ static zend_result php_session_send_cookie(void)
1409
1409
t = tv .tv_sec + PS (cookie_lifetime );
1410
1410
1411
1411
if (t > 0 ) {
1412
- date_fmt = php_format_date ("D, d M Y H:i:s \\G\\M\\T" , sizeof ("D, d M Y H:i:s \\G\\M\\T" )- 1 , t , 0 );
1412
+ date_fmt = php_format_date (ZEND_STRL ("D, d M Y H:i:s \\G\\M\\T" ), t , false );
1413
1413
smart_str_appends (& ncookie , COOKIE_EXPIRES );
1414
1414
smart_str_append (& ncookie , date_fmt );
1415
1415
zend_string_release_ex (date_fmt , 0 );
@@ -1515,8 +1515,8 @@ PHPAPI zend_result php_session_reset_id(void)
1515
1515
1516
1516
/* If the SID constant exists, destroy it. */
1517
1517
/* We must not delete any items in EG(zend_constants) */
1518
- /* zend_hash_str_del(EG(zend_constants), "sid", sizeof ("sid") - 1 ); */
1519
- sid = zend_get_constant_str ("SID" , sizeof ("SID" ) - 1 );
1518
+ /* zend_hash_str_del(EG(zend_constants), ZEND_STRL ("sid")); */
1519
+ sid = zend_get_constant_str (ZEND_STRL ("SID" ));
1520
1520
1521
1521
if (PS (define_sid )) {
1522
1522
smart_str var = {0 };
@@ -1546,7 +1546,7 @@ PHPAPI zend_result php_session_reset_id(void)
1546
1546
if (APPLY_TRANS_SID ) {
1547
1547
apply_trans_sid = 1 ;
1548
1548
if (PS (use_cookies ) &&
1549
- (data = zend_hash_str_find (& EG (symbol_table ), "_COOKIE" , sizeof ("_COOKIE" ) - 1 ))) {
1549
+ (data = zend_hash_str_find (& EG (symbol_table ), ZEND_STRL ("_COOKIE" )))) {
1550
1550
ZVAL_DEREF (data );
1551
1551
if (Z_TYPE_P (data ) == IS_ARRAY &&
1552
1552
(ppid = zend_hash_str_find (Z_ARRVAL_P (data ), PS (session_name ), strlen (PS (session_name ))))) {
@@ -1580,15 +1580,15 @@ PHPAPI zend_result php_session_start(void)
1580
1580
break ;
1581
1581
1582
1582
case php_session_disabled :
1583
- value = zend_ini_string ("session.save_handler" , sizeof ("session.save_handler" ) - 1 , 0 );
1583
+ value = zend_ini_string (ZEND_STRL ("session.save_handler" ), false );
1584
1584
if (!PS (mod ) && value ) {
1585
1585
PS (mod ) = _php_find_ps_module (value );
1586
1586
if (!PS (mod )) {
1587
1587
php_error_docref (NULL , E_WARNING , "Cannot find session save handler \"%s\" - session startup failed" , value );
1588
1588
return FAILURE ;
1589
1589
}
1590
1590
}
1591
- value = zend_ini_string ("session.serialize_handler" , sizeof ("session.serialize_handler" ) - 1 , 0 );
1591
+ value = zend_ini_string (ZEND_STRL ("session.serialize_handler" ), false );
1592
1592
if (!PS (serializer ) && value ) {
1593
1593
PS (serializer ) = _php_find_ps_serializer (value );
1594
1594
if (!PS (serializer )) {
@@ -1617,7 +1617,7 @@ PHPAPI zend_result php_session_start(void)
1617
1617
*/
1618
1618
1619
1619
if (!PS (id )) {
1620
- if (PS (use_cookies ) && (data = zend_hash_str_find (& EG (symbol_table ), "_COOKIE" , sizeof ("_COOKIE" ) - 1 ))) {
1620
+ if (PS (use_cookies ) && (data = zend_hash_str_find (& EG (symbol_table ), ZEND_STRL ("_COOKIE" )))) {
1621
1621
ZVAL_DEREF (data );
1622
1622
if (Z_TYPE_P (data ) == IS_ARRAY && (ppid = zend_hash_str_find (Z_ARRVAL_P (data ), PS (session_name ), lensess ))) {
1623
1623
ppid2sid (ppid );
@@ -1627,13 +1627,13 @@ PHPAPI zend_result php_session_start(void)
1627
1627
}
1628
1628
/* Initialize session ID from non cookie values */
1629
1629
if (!PS (use_only_cookies )) {
1630
- if (!PS (id ) && (data = zend_hash_str_find (& EG (symbol_table ), "_GET" , sizeof ("_GET" ) - 1 ))) {
1630
+ if (!PS (id ) && (data = zend_hash_str_find (& EG (symbol_table ), ZEND_STRL ("_GET" )))) {
1631
1631
ZVAL_DEREF (data );
1632
1632
if (Z_TYPE_P (data ) == IS_ARRAY && (ppid = zend_hash_str_find (Z_ARRVAL_P (data ), PS (session_name ), lensess ))) {
1633
1633
ppid2sid (ppid );
1634
1634
}
1635
1635
}
1636
- if (!PS (id ) && (data = zend_hash_str_find (& EG (symbol_table ), "_POST" , sizeof ("_POST" ) - 1 ))) {
1636
+ if (!PS (id ) && (data = zend_hash_str_find (& EG (symbol_table ), ZEND_STRL ("_POST" )))) {
1637
1637
ZVAL_DEREF (data );
1638
1638
if (Z_TYPE_P (data ) == IS_ARRAY && (ppid = zend_hash_str_find (Z_ARRVAL_P (data ), PS (session_name ), lensess ))) {
1639
1639
ppid2sid (ppid );
@@ -1643,7 +1643,7 @@ PHPAPI zend_result php_session_start(void)
1643
1643
* an external site which invalidates the previously found id. */
1644
1644
if (PS (id ) && PS (extern_referer_chk )[0 ] != '\0' &&
1645
1645
!Z_ISUNDEF (PG (http_globals )[TRACK_VARS_SERVER ]) &&
1646
- (data = zend_hash_str_find (Z_ARRVAL (PG (http_globals )[TRACK_VARS_SERVER ]), "HTTP_REFERER" , sizeof ("HTTP_REFERER" ) - 1 )) &&
1646
+ (data = zend_hash_str_find (Z_ARRVAL (PG (http_globals )[TRACK_VARS_SERVER ]), ZEND_STRL ("HTTP_REFERER" ))) &&
1647
1647
Z_TYPE_P (data ) == IS_STRING &&
1648
1648
Z_STRLEN_P (data ) != 0 &&
1649
1649
strstr (Z_STRVAL_P (data ), PS (extern_referer_chk )) == NULL
@@ -2794,7 +2794,7 @@ static zend_result php_rinit_session(bool auto_start)
2794
2794
{
2795
2795
char * value ;
2796
2796
2797
- value = zend_ini_string ("session.save_handler" , sizeof ("session.save_handler" ) - 1 , 0 );
2797
+ value = zend_ini_string (ZEND_STRL ("session.save_handler" ), false );
2798
2798
if (value ) {
2799
2799
PS (mod ) = _php_find_ps_module (value );
2800
2800
}
@@ -2803,7 +2803,7 @@ static zend_result php_rinit_session(bool auto_start)
2803
2803
if (PS (serializer ) == NULL ) {
2804
2804
char * value ;
2805
2805
2806
- value = zend_ini_string ("session.serialize_handler" , sizeof ("session.serialize_handler" ) - 1 , 0 );
2806
+ value = zend_ini_string (ZEND_STRL ("session.serialize_handler" ), false );
2807
2807
if (value ) {
2808
2808
PS (serializer ) = _php_find_ps_serializer (value );
2809
2809
}
@@ -2907,7 +2907,7 @@ static PHP_GINIT_FUNCTION(ps)
2907
2907
2908
2908
static PHP_MINIT_FUNCTION (session )
2909
2909
{
2910
- zend_register_auto_global (zend_string_init_interned ("_SESSION" , sizeof ("_SESSION" ) - 1 , 1 ), 0 , NULL );
2910
+ zend_register_auto_global (zend_string_init_interned (ZEND_STRL ("_SESSION" ), true ), false , NULL );
2911
2911
2912
2912
my_module_number = module_number ;
2913
2913
PS (module_number ) = module_number ;
@@ -3058,7 +3058,7 @@ static bool php_check_cancel_upload(php_session_rfc1867_progress *progress)
3058
3058
if (Z_TYPE_P (progress_ary ) != IS_ARRAY ) {
3059
3059
return 0 ;
3060
3060
}
3061
- if ((cancel_upload = zend_hash_str_find (Z_ARRVAL_P (progress_ary ), "cancel_upload" , sizeof ("cancel_upload" ) - 1 )) == NULL ) {
3061
+ if ((cancel_upload = zend_hash_str_find (Z_ARRVAL_P (progress_ary ), ZEND_STRL ("cancel_upload" ))) == NULL ) {
3062
3062
return 0 ;
3063
3063
}
3064
3064
return Z_TYPE_P (cancel_upload ) == IS_TRUE ;
@@ -3189,13 +3189,13 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
3189
3189
array_init (& progress -> data );
3190
3190
array_init (& progress -> files );
3191
3191
3192
- add_assoc_long_ex (& progress -> data , "start_time" , sizeof ("start_time" ) - 1 , (zend_long )sapi_get_request_time ());
3193
- add_assoc_long_ex (& progress -> data , "content_length" , sizeof ("content_length" ) - 1 , progress -> content_length );
3194
- add_assoc_long_ex (& progress -> data , "bytes_processed" , sizeof ("bytes_processed" ) - 1 , data -> post_bytes_processed );
3195
- add_assoc_bool_ex (& progress -> data , "done" , sizeof ("done" ) - 1 , 0 );
3196
- add_assoc_zval_ex (& progress -> data , "files" , sizeof ("files" ) - 1 , & progress -> files );
3192
+ add_assoc_long_ex (& progress -> data , ZEND_STRL ("start_time" ), (zend_long )sapi_get_request_time ());
3193
+ add_assoc_long_ex (& progress -> data , ZEND_STRL ("content_length" ), progress -> content_length );
3194
+ add_assoc_long_ex (& progress -> data , ZEND_STRL ("bytes_processed" ), data -> post_bytes_processed );
3195
+ add_assoc_bool_ex (& progress -> data , ZEND_STRL ("done" ), false );
3196
+ add_assoc_zval_ex (& progress -> data , ZEND_STRL ("files" ), & progress -> files );
3197
3197
3198
- progress -> post_bytes_processed = zend_hash_str_find (Z_ARRVAL (progress -> data ), "bytes_processed" , sizeof ("bytes_processed" ) - 1 );
3198
+ progress -> post_bytes_processed = zend_hash_str_find (Z_ARRVAL (progress -> data ), ZEND_STRL ("bytes_processed" ));
3199
3199
3200
3200
php_rinit_session (0 );
3201
3201
PS (id ) = zend_string_copy (Z_STR (progress -> sid ));
@@ -3210,18 +3210,18 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
3210
3210
array_init (& progress -> current_file );
3211
3211
3212
3212
/* Each uploaded file has its own array. Trying to make it close to $_FILES entries. */
3213
- add_assoc_string_ex (& progress -> current_file , "field_name" , sizeof ("field_name" ) - 1 , data -> name );
3214
- add_assoc_string_ex (& progress -> current_file , "name" , sizeof ("name" ) - 1 , * data -> filename );
3215
- add_assoc_null_ex (& progress -> current_file , "tmp_name" , sizeof ("tmp_name" ) - 1 );
3216
- add_assoc_long_ex (& progress -> current_file , "error" , sizeof ("error" ) - 1 , 0 );
3213
+ add_assoc_string_ex (& progress -> current_file , ZEND_STRL ("field_name" ), data -> name );
3214
+ add_assoc_string_ex (& progress -> current_file , ZEND_STRL ("name" ), * data -> filename );
3215
+ add_assoc_null_ex (& progress -> current_file , ZEND_STRL ("tmp_name" ));
3216
+ add_assoc_long_ex (& progress -> current_file , ZEND_STRL ("error" ), 0 );
3217
3217
3218
- add_assoc_bool_ex (& progress -> current_file , "done" , sizeof ("done" ) - 1 , 0 );
3219
- add_assoc_long_ex (& progress -> current_file , "start_time" , sizeof ("start_time" ) - 1 , (zend_long )time (NULL ));
3220
- add_assoc_long_ex (& progress -> current_file , "bytes_processed" , sizeof ("bytes_processed" ) - 1 , 0 );
3218
+ add_assoc_bool_ex (& progress -> current_file , ZEND_STRL ("done" ), 0 );
3219
+ add_assoc_long_ex (& progress -> current_file , ZEND_STRL ("start_time" ), (zend_long )time (NULL ));
3220
+ add_assoc_long_ex (& progress -> current_file , ZEND_STRL ("bytes_processed" ), 0 );
3221
3221
3222
3222
add_next_index_zval (& progress -> files , & progress -> current_file );
3223
3223
3224
- progress -> current_file_bytes_processed = zend_hash_str_find (Z_ARRVAL (progress -> current_file ), "bytes_processed" , sizeof ("bytes_processed" ) - 1 );
3224
+ progress -> current_file_bytes_processed = zend_hash_str_find (Z_ARRVAL (progress -> current_file ), ZEND_STRL ("bytes_processed" ));
3225
3225
3226
3226
Z_LVAL_P (progress -> current_file_bytes_processed ) = data -> post_bytes_processed ;
3227
3227
php_session_rfc1867_update (progress , 0 );
@@ -3248,11 +3248,11 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
3248
3248
}
3249
3249
3250
3250
if (data -> temp_filename ) {
3251
- add_assoc_string_ex (& progress -> current_file , "tmp_name" , sizeof ("tmp_name" ) - 1 , data -> temp_filename );
3251
+ add_assoc_string_ex (& progress -> current_file , ZEND_STRL ("tmp_name" ), data -> temp_filename );
3252
3252
}
3253
3253
3254
- add_assoc_long_ex (& progress -> current_file , "error" , sizeof ("error" ) - 1 , data -> cancel_upload );
3255
- add_assoc_bool_ex (& progress -> current_file , "done" , sizeof ("done" ) - 1 , 1 );
3254
+ add_assoc_long_ex (& progress -> current_file , ZEND_STRL ("error" ), data -> cancel_upload );
3255
+ add_assoc_bool_ex (& progress -> current_file , ZEND_STRL ("done" ), 1 );
3256
3256
3257
3257
Z_LVAL_P (progress -> post_bytes_processed ) = data -> post_bytes_processed ;
3258
3258
@@ -3268,7 +3268,7 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
3268
3268
} else {
3269
3269
if (!Z_ISUNDEF (progress -> data )) {
3270
3270
SEPARATE_ARRAY (& progress -> data );
3271
- add_assoc_bool_ex (& progress -> data , "done" , sizeof ("done" ) - 1 , 1 );
3271
+ add_assoc_bool_ex (& progress -> data , ZEND_STRL ("done" ), 1 );
3272
3272
Z_LVAL_P (progress -> post_bytes_processed ) = data -> post_bytes_processed ;
3273
3273
php_session_rfc1867_update (progress , 1 );
3274
3274
}
0 commit comments