@@ -313,15 +313,15 @@ PHP_FUNCTION(apache_getenv)
313
313
}
314
314
/* }}} */
315
315
316
- static char * php_apache_get_version (void )
316
+ static const char * php_apache_get_version (void )
317
317
{
318
- return ( char * ) ap_get_server_banner ();
318
+ return ap_get_server_banner ();
319
319
}
320
320
321
321
/* {{{ Fetch Apache version */
322
322
PHP_FUNCTION (apache_get_version )
323
323
{
324
- char * apv = php_apache_get_version ();
324
+ const char * apv = php_apache_get_version ();
325
325
326
326
if (apv && * apv ) {
327
327
RETURN_STRING (apv );
@@ -340,7 +340,7 @@ PHP_FUNCTION(apache_get_modules)
340
340
array_init (return_value );
341
341
342
342
for (n = 0 ; ap_loaded_modules [n ]; ++ n ) {
343
- char * s = ( char * ) ap_loaded_modules [n ]-> name ;
343
+ const char * s = ap_loaded_modules [n ]-> name ;
344
344
if ((p = strchr (s , '.' ))) {
345
345
add_next_index_stringl (return_value , s , (p - s ));
346
346
} else {
@@ -352,7 +352,7 @@ PHP_FUNCTION(apache_get_modules)
352
352
353
353
PHP_MINFO_FUNCTION (apache )
354
354
{
355
- char * apv = php_apache_get_version ();
355
+ const char * apv = php_apache_get_version ();
356
356
smart_str tmp1 = {0 };
357
357
char tmp [1024 ];
358
358
int n , max_requests ;
@@ -363,21 +363,20 @@ PHP_MINFO_FUNCTION(apache)
363
363
#endif
364
364
365
365
for (n = 0 ; ap_loaded_modules [n ]; ++ n ) {
366
- char * s = (char * ) ap_loaded_modules [n ]-> name ;
366
+ const char * s = ap_loaded_modules [n ]-> name ;
367
+ if (n > 0 ) {
368
+ smart_str_appendc (& tmp1 , ' ' );
369
+ }
367
370
if ((p = strchr (s , '.' ))) {
368
371
smart_str_appendl (& tmp1 , s , (p - s ));
369
372
} else {
370
373
smart_str_appends (& tmp1 , s );
371
374
}
372
- smart_str_appendc (& tmp1 , ' ' );
373
375
}
374
- if (tmp1 .s ) {
375
- if (tmp1 .s -> len > 0 ) {
376
- tmp1 .s -> val [tmp1 .s -> len - 1 ] = '\0' ;
377
- } else {
378
- tmp1 .s -> val [0 ] = '\0' ;
379
- }
376
+ if (!tmp1 .s ) {
377
+ smart_str_appendc (& tmp1 , '/' );
380
378
}
379
+ smart_str_0 (& tmp1 );
381
380
382
381
php_info_print_table_start ();
383
382
if (apv && * apv ) {
@@ -409,7 +408,7 @@ PHP_MINFO_FUNCTION(apache)
409
408
410
409
php_info_print_table_row (2 , "Virtual Server" , (serv -> is_virtual ? "Yes" : "No" ));
411
410
php_info_print_table_row (2 , "Server Root" , ap_server_root );
412
- php_info_print_table_row (2 , "Loaded Modules" , tmp1 .s -> val );
411
+ php_info_print_table_row (2 , "Loaded Modules" , ZSTR_VAL ( tmp1 .s ) );
413
412
414
413
smart_str_free (& tmp1 );
415
414
php_info_print_table_end ();
0 commit comments