diff options
Diffstat (limited to 'sapi/apache2handler/php_functions.c')
| -rw-r--r-- | sapi/apache2handler/php_functions.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index d9ae4d97ea..d038f9e9b9 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -288,8 +288,8 @@ PHP_FUNCTION(apache_setenv) PHP_FUNCTION(apache_getenv) { php_struct *ctx; - char *variable=NULL; - int variable_len; + char *variable; + size_t variable_len; zend_bool walk_to_top = 0; int arg_count = ZEND_NUM_ARGS(); char *env_val=NULL; @@ -388,8 +388,12 @@ PHP_MINFO_FUNCTION(apache) } smart_str_appendc(&tmp1, ' '); } - if (tmp1.s && (tmp1.s->len - 1) >= 0) { - tmp1.s->val[tmp1.s->len - 1] = '\0'; + if (tmp1.s) { + if (tmp1.s->len > 0) { + tmp1.s->val[tmp1.s->len - 1] = '\0'; + } else { + tmp1.s->val[0] = '\0'; + } } php_info_print_table_start(); |
