cvs: /php4 mod_php4.c /php4/ext/standard info.c post.c
| From: | Zeev Suraski | Date: | Mon, 13 Sep 1999 00:35:04 +0000 |
| Subject: | cvs: /php4 mod_php4.c /php4/ext/standard info.c post.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4376@lists.php.net to get a copy of this message | ||
zeev Sun Sep 12 20:35:04 1999 EDT
Modified files:
/php4 mod_php4.c
/php4/ext/standard info.c post.c
Log:
Fix a buglet, and avoid crashing in phpinfo() (fixes an elusive legacy bug too)
Index: php4/mod_php4.c
diff -u php4/mod_php4.c:1.24 php4/mod_php4.c:1.25
--- php4/mod_php4.c:1.24 Sun Sep 12 16:36:48 1999
+++ php4/mod_php4.c Sun Sep 12 20:35:03 1999
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php4.c,v 1.24 1999/09/12 20:36:48 zeev Exp $ */
+/* $Id: mod_php4.c,v 1.25 1999/09/13 00:35:03 zeev Exp $ */
#include "httpd.h"
#include "http_config.h"
@@ -36,6 +36,7 @@
#include "php.h"
#include "php_ini.h"
+#include "php_globals.h"
#include "SAPI.h"
#include "main.h"
@@ -241,6 +242,7 @@
static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry)
{
php_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1,
per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type);
+ return 0;
}
@@ -488,7 +490,7 @@
apache_php_initialized = 1;
}
#if MODULE_MAGIC_NUMBER >= 19980527
- if (INI_INT(PG(expose_php)) {
+ if (PG(expose_php)) {
ap_add_version_component("PHP/" PHP_VERSION);
}
#endif
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.31 php4/ext/standard/info.c:1.32
--- php4/ext/standard/info.c:1.31 Sat Sep 11 12:32:08 1999
+++ php4/ext/standard/info.c Sun Sep 12 20:35:03 1999
@@ -191,7 +191,16 @@
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 @@
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) {
Index: php4/ext/standard/post.c
diff -u php4/ext/standard/post.c:1.23 php4/ext/standard/post.c:1.24
--- php4/ext/standard/post.c:1.23 Sun Sep 12 19:51:12 1999
+++ php4/ext/standard/post.c Sun Sep 12 20:35:03 1999
@@ -295,6 +295,7 @@
if (symtable2 && top_gpc_p) {
zend_hash_update(symtable2, var, var_len+1, top_gpc_p, sizeof(zval *), NULL);
+ (*top_gpc_p)->refcount++;
}
}