pollita Sat Sep 6 02:57:41 2003 EDT
Modified files:
/php-src/ext/standard http.c
Log:
Fix segfault on uninitialized zval, skip NULL/Resource types, fix integer value
handling, and process doubles/bools more efficiently.
Index: php-src/ext/standard/http.c
diff -u php-src/ext/standard/http.c:1.2 php-src/ext/standard/http.c:1.3
--- php-src/ext/standard/http.c:1.2 Sat Sep 6 01:41:36 2003
+++ php-src/ext/standard/http.c Sat Sep 6 02:57:40 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http.c,v 1.2 2003/09/06 05:41:36 pollita Exp $ */
+/* $Id: http.c,v 1.3 2003/09/06 06:57:40 pollita Exp $ */
#include "http.h"
#include "php_ini.h"
@@ -115,6 +115,9 @@
php_url_encode_hash_ex(Z_ARRVAL_PP(zdata), formstr, NULL, 0,
newprefix, newprefix_len, "]", 1 TSRMLS_CC);
ht->nApplyCount--;
efree(newprefix);
+ } else if (Z_TYPE_PP(zdata) == IS_NULL || Z_TYPE_PP(zdata) ==
IS_RESOURCE) {
+ /* Skip these types */
+ continue;
} else {
if (formstr->len) {
smart_str_appendl(formstr, arg_sep, arg_sep_len);
@@ -141,10 +144,15 @@
ekey = php_url_encode(Z_STRVAL_PP(zdata),
Z_STRLEN_PP(zdata), &ekey_len);
break;
case IS_LONG:
- ekey_len = spprintf(&ekey, 12, "%ld", idx);
+ case IS_BOOL:
+ ekey_len = spprintf(&ekey, 12, "%ld",
Z_LVAL_PP(zdata));
+ break;
+ case IS_DOUBLE:
+ ekey_len = spprintf(&ekey, 48, "%.*G", (int)
EG(precision), Z_DVAL_PP(zdata));
break;
default:
/* fall back on convert to string */
+ MAKE_STD_ZVAL(copyzval);
*copyzval = **zdata;
zval_copy_ctor(copyzval);
convert_to_string_ex(©zval);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php