@@ -155,7 +155,7 @@ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC)
155
155
156
156
/* {{{ sapi_lsapi_flush
157
157
*/
158
- static void sapi_lsapi_flush ( void * server_context TSRMLS_DC )
158
+ static void sapi_lsapi_flush ( void * server_context )
159
159
{
160
160
if ( lsapi_mode ) {
161
161
if ( LSAPI_Flush () == -1 ) {
@@ -200,12 +200,7 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC )
200
200
static int add_variable ( const char * pKey , int keyLen , const char * pValue , int valLen ,
201
201
void * arg )
202
202
{
203
- #if PHP_MAJOR_VERSION >= 7
204
- int filter_arg = (Z_ARR_P ((zval * )arg ) == Z_ARR (PG (http_globals )[TRACK_VARS_ENV ]))
205
- ? PARSE_ENV : PARSE_SERVER ;
206
- #else
207
- int filter_arg = (arg == PG (http_globals )[TRACK_VARS_ENV ])?PARSE_ENV :PARSE_SERVER ;
208
- #endif
203
+ int filter_arg = (arg == PG (http_globals )[TRACK_VARS_ENV ])?PARSE_ENV :PARSE_SERVER ;
209
204
char * new_val = (char * ) pValue ;
210
205
unsigned int new_val_len ;
211
206
@@ -243,45 +238,27 @@ static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC
243
238
size_t alloc_size = sizeof (buf );
244
239
unsigned long nlen ; /* ptrdiff_t is not portable */
245
240
246
- # if PHP_MAJOR_VERSION >= 7
247
- if ( Z_TYPE ( PG (http_globals )[TRACK_VARS_ENV ]) == IS_ARRAY &&
248
- Z_ARR_P ( array_ptr ) != Z_ARR ( PG (http_globals )[TRACK_VARS_ENV ]) &&
249
- zend_hash_num_elements (Z_ARRVAL (PG (http_globals )[TRACK_VARS_ENV ])) > 0
241
+ if ( PG ( http_globals )[ TRACK_VARS_ENV ] &&
242
+ array_ptr != PG (http_globals )[TRACK_VARS_ENV ] &&
243
+ Z_TYPE_P ( PG (http_globals )[TRACK_VARS_ENV ]) == IS_ARRAY &&
244
+ zend_hash_num_elements (Z_ARRVAL_P (PG (http_globals )[TRACK_VARS_ENV ])) > 0
250
245
) {
251
- zval_dtor (array_ptr );
252
- ZVAL_DUP (array_ptr , & PG (http_globals )[TRACK_VARS_ENV ]);
246
+ zval_dtor (array_ptr );
247
+ * array_ptr = * PG (http_globals )[TRACK_VARS_ENV ];
248
+ INIT_PZVAL (array_ptr );
249
+ zval_copy_ctor (array_ptr );
253
250
return ;
254
- } else if (Z_TYPE (PG (http_globals )[TRACK_VARS_SERVER ]) == IS_ARRAY &&
255
- Z_ARR_P (array_ptr ) != Z_ARR (PG (http_globals )[TRACK_VARS_SERVER ]) &&
256
- zend_hash_num_elements (Z_ARRVAL (PG (http_globals )[TRACK_VARS_SERVER ])) > 0
251
+ } else if (PG (http_globals )[TRACK_VARS_SERVER ] &&
252
+ array_ptr != PG (http_globals )[TRACK_VARS_SERVER ] &&
253
+ Z_TYPE_P (PG (http_globals )[TRACK_VARS_SERVER ]) == IS_ARRAY &&
254
+ zend_hash_num_elements (Z_ARRVAL_P (PG (http_globals )[TRACK_VARS_SERVER ])) > 0
257
255
) {
258
- zval_dtor (array_ptr );
259
- ZVAL_DUP (array_ptr , & PG (http_globals )[TRACK_VARS_SERVER ]);
256
+ zval_dtor (array_ptr );
257
+ * array_ptr = * PG (http_globals )[TRACK_VARS_SERVER ];
258
+ INIT_PZVAL (array_ptr );
259
+ zval_copy_ctor (array_ptr );
260
260
return ;
261
261
}
262
- #else
263
- if (PG (http_globals )[TRACK_VARS_ENV ] &&
264
- array_ptr != PG (http_globals )[TRACK_VARS_ENV ] &&
265
- Z_TYPE_P (PG (http_globals )[TRACK_VARS_ENV ]) == IS_ARRAY &&
266
- zend_hash_num_elements (Z_ARRVAL_P (PG (http_globals )[TRACK_VARS_ENV ])) > 0
267
- ) {
268
- zval_dtor (array_ptr );
269
- * array_ptr = * PG (http_globals )[TRACK_VARS_ENV ];
270
- INIT_PZVAL (array_ptr );
271
- zval_copy_ctor (array_ptr );
272
- return ;
273
- } else if (PG (http_globals )[TRACK_VARS_SERVER ] &&
274
- array_ptr != PG (http_globals )[TRACK_VARS_SERVER ] &&
275
- Z_TYPE_P (PG (http_globals )[TRACK_VARS_SERVER ]) == IS_ARRAY &&
276
- zend_hash_num_elements (Z_ARRVAL_P (PG (http_globals )[TRACK_VARS_SERVER ])) > 0
277
- ) {
278
- zval_dtor (array_ptr );
279
- * array_ptr = * PG (http_globals )[TRACK_VARS_SERVER ];
280
- INIT_PZVAL (array_ptr );
281
- zval_copy_ctor (array_ptr );
282
- return ;
283
- }
284
- #endif
285
262
286
263
for (env = environ ; env != NULL && * env != NULL ; env ++ ) {
287
264
p = strchr (* env , '=' );
@@ -615,9 +592,6 @@ static int lsapi_module_main(int show_source TSRMLS_DC)
615
592
static int alter_ini ( const char * pKey , int keyLen , const char * pValue , int valLen ,
616
593
void * arg )
617
594
{
618
- #if PHP_MAJOR_VERSION >= 7
619
- zend_string * psKey ;
620
- #endif
621
595
int type = ZEND_INI_PERDIR ;
622
596
if ( '\001' == * pKey ) {
623
597
++ pKey ;
@@ -632,19 +606,9 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va
632
606
engine = 0 ;
633
607
}
634
608
else
635
- {
636
- #if PHP_MAJOR_VERSION >= 7
637
- psKey = STR_INIT ( pKey , keyLen , 1 );
638
- zend_alter_ini_entry (psKey ,
639
- (char * )pValue , valLen ,
640
- type , PHP_INI_STAGE_ACTIVATE );
641
- STR_RELEASE ( psKey );
642
- #else
643
609
zend_alter_ini_entry ((char * )pKey , keyLen ,
644
610
(char * )pValue , valLen ,
645
- type , PHP_INI_STAGE_ACTIVATE );
646
- #endif
647
- }
611
+ type , PHP_INI_STAGE_ACTIVATE );
648
612
}
649
613
return 1 ;
650
614
}
@@ -785,9 +749,6 @@ static int cli_main( int argc, char * argv[] )
785
749
char * * argend = & argv [argc ];
786
750
int ret = -1 ;
787
751
int c ;
788
- #if PHP_MAJOR_VERSION >= 7
789
- zend_string * psKey ;
790
- #endif
791
752
lsapi_mode = 0 ; /* enter CLI mode */
792
753
793
754
#ifdef PHP_WIN32
@@ -802,21 +763,12 @@ static int cli_main( int argc, char * argv[] )
802
763
803
764
zend_uv .html_errors = 0 ; /* tell the engine we're in non-html mode */
804
765
CG (in_compilation ) = 0 ; /* not initialized but needed for several options */
805
- #if PHP_MAJOR_VERSION < 7
806
766
EG (uninitialized_zval_ptr ) = NULL ;
807
- #endif
767
+
808
768
for ( ini = ini_defaults ; * ini ; ini += 2 ) {
809
- #if PHP_MAJOR_VERSION >= 7
810
- psKey = STR_INIT ( * ini , strlen ( * ini ), 1 );
811
- zend_alter_ini_entry ( psKey ,
812
- (char * )* (ini + 1 ), strlen ( * (ini + 1 ) ),
813
- PHP_INI_SYSTEM , PHP_INI_STAGE_ACTIVATE );
814
- STR_RELEASE ( psKey );
815
- #else
816
769
zend_alter_ini_entry ( (char * )* ini , strlen ( * ini )+ 1 ,
817
770
(char * )* (ini + 1 ), strlen ( * (ini + 1 ) ),
818
771
PHP_INI_SYSTEM , PHP_INI_STAGE_ACTIVATE );
819
- #endif
820
772
}
821
773
822
774
while (( p < argend )&& (* * p == '-' )) {
@@ -1196,11 +1148,7 @@ zend_module_entry litespeed_module_entry = {
1196
1148
static int add_associate_array ( const char * pKey , int keyLen , const char * pValue , int valLen ,
1197
1149
void * arg )
1198
1150
{
1199
- add_assoc_string_ex ( (zval * )arg , (char * )pKey , keyLen + 1 , (char * )pValue
1200
- #if PHP_MAJOR_VERSION < 7
1201
- , 1
1202
- #endif
1203
- );
1151
+ add_assoc_string_ex ( (zval * )arg , (char * )pKey , keyLen + 1 , (char * )pValue , 1 );
1204
1152
return 1 ;
1205
1153
}
1206
1154
@@ -1254,11 +1202,7 @@ PHP_FUNCTION(litespeed_response_headers)
1254
1202
headerBuf [len ] = 0 ;
1255
1203
if ( len ) {
1256
1204
while ( isspace (* ++ p ));
1257
- add_assoc_string_ex (return_value , headerBuf , len + 1 , p
1258
- #if PHP_MAJOR_VERSION < 7
1259
- , 1
1260
- #endif
1261
- );
1205
+ add_assoc_string_ex (return_value , headerBuf , len + 1 , p , 1 );
1262
1206
}
1263
1207
}
1264
1208
}
@@ -1273,25 +1217,15 @@ PHP_FUNCTION(litespeed_response_headers)
1273
1217
Fetch all loaded module names */
1274
1218
PHP_FUNCTION (apache_get_modules )
1275
1219
{
1276
- static const char * mod_names [] =
1277
- {
1278
- "mod_rewrite" , "mod_mime" , "mod_headers" , "mod_expires" , NULL
1279
- };
1280
- const char * * name = mod_names ;
1281
1220
/* TODO: */
1282
1221
if (ZEND_NUM_ARGS () > 0 ) {
1283
1222
WRONG_PARAM_COUNT ;
1284
1223
}
1285
1224
array_init (return_value );
1286
- while ( * name )
1287
- {
1288
- add_next_index_string (return_value , * name
1289
- #if PHP_MAJOR_VERSION < 7
1290
- , 1
1291
- #endif
1292
- );
1293
- ++ name ;
1294
- }
1225
+ add_next_index_string (return_value , "mod_rewrite" , 1 );
1226
+ add_next_index_string (return_value , "mod_mime" , 1 );
1227
+ add_next_index_string (return_value , "mod_headers" , 1 );
1228
+ add_next_index_string (return_value , "mod_expires" , 1 );
1295
1229
}
1296
1230
/* }}} */
1297
1231
0 commit comments