summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-09-13 00:35:03 +0000
committerZeev Suraski <zeev@php.net>1999-09-13 00:35:03 +0000
commit3f0696dada83f24df10dc1a0c05980690584eadf (patch)
tree2bdbaacd6212b2da9f72c23de2373a9562909632 /ext
parentb2c0acb9ecc43387328a30cc3bb85ebd35fc454b (diff)
downloadphp-git-3f0696dada83f24df10dc1a0c05980690584eadf.tar.gz
Fix a buglet, and avoid crashing in phpinfo() (fixes an elusive legacy bug too)
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/info.c16
-rw-r--r--ext/standard/post.c1
2 files changed, 15 insertions, 2 deletions
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 87c52a7ce5..f125662073 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -191,7 +191,16 @@ PHPAPI void php_print_info(int flag)
if (zend_hash_find(&EG(symbol_table), "HTTP_GET_VARS", sizeof("HTTP_GET_VARS"), (void **) &data) != FAILURE) {
zend_hash_internal_pointer_reset((*data)->value.ht);
while (zend_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
- convert_to_string(*tmp);
+ zval tmp2, *value_ptr;
+
+ if ((*tmp)->type != IS_STRING) {
+ tmp2 = **tmp;
+ zval_copy_ctor(&tmp2);
+ convert_to_string(&tmp2);
+ value_ptr = &tmp2;
+ } else {
+ value_ptr = *tmp;
+ }
PUTS("<tr><td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>HTTP_GET_VARS[\"");
switch (zend_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
case HASH_KEY_IS_STRING:
@@ -203,9 +212,12 @@ PHPAPI void php_print_info(int flag)
break;
}
PUTS("\"]</b></td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
- PUTS((*tmp)->value.str.val); /* This could be "Array" - too ugly to expand that for now */
+ PUTS(value_ptr->value.str.val); /* This could be "Array" - too ugly to expand that for now */
PUTS("</td></tr>\n");
zend_hash_move_forward((*data)->value.ht);
+ if (value_ptr==&tmp2) {
+ zval_dtor(value_ptr);
+ }
}
}
if (zend_hash_find(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), (void **) &data) != FAILURE) {
diff --git a/ext/standard/post.c b/ext/standard/post.c
index 2599690222..8b37dc8ed2 100644
--- a/ext/standard/post.c
+++ b/ext/standard/post.c
@@ -295,6 +295,7 @@ void php_parse_gpc_data2(char *val, char *var, pval *track_vars_array ELS_DC PLS
if (symtable2 && top_gpc_p) {
zend_hash_update(symtable2, var, var_len+1, top_gpc_p, sizeof(zval *), NULL);
+ (*top_gpc_p)->refcount++;
}
}