moriyoshi Wed Oct 30 06:42:51 2002 EDT
Modified files:
/php4/ext/standard string.c
Log:
Fixed bug #20169
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.329 php4/ext/standard/string.c:1.330
--- php4/ext/standard/string.c:1.329 Fri Oct 25 16:09:53 2002
+++ php4/ext/standard/string.c Wed Oct 30 06:42:51 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.329 2002/10/25 20:09:53 iliaa Exp $ */
+/* $Id: string.c,v 1.330 2002/10/30 11:42:51 moriyoshi Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -848,6 +848,7 @@
{
zval **arg1 = NULL, **arg2 = NULL, *delim, *arr;
int argc = ZEND_NUM_ARGS();
+ int arg1_separated = 0, arg2_separated = 0, delim_needs_dtor = 0;
if (argc < 1 || argc > 2 ||
zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) {
@@ -865,15 +866,19 @@
ZVAL_STRINGL(delim, _IMPL_EMPTY, sizeof(_IMPL_EMPTY) - 1, 0);
SEPARATE_ZVAL(arg1);
+ arg1_separated = 1;
+ delim_needs_dtor = 1;
arr = *arg1;
} else {
if (Z_TYPE_PP(arg1) == IS_ARRAY) {
SEPARATE_ZVAL(arg1);
+ arg1_separated = 1;
arr = *arg1;
convert_to_string_ex(arg2);
delim = *arg2;
} else if (Z_TYPE_PP(arg2) == IS_ARRAY) {
SEPARATE_ZVAL(arg2);
+ arg2_separated = 1;
arr = *arg2;
convert_to_string_ex(arg1);
delim = *arg1;
@@ -884,12 +889,9 @@
}
php_implode(delim, arr, return_value);
- zval_ptr_dtor(arg1);
- if (arg2) {
- zval_ptr_dtor(arg2);
- } else {
- FREE_ZVAL(delim);
- }
+ if (arg1 != NULL && arg1_separated) zval_ptr_dtor(arg1);
+ if (arg2 != NULL && arg2_separated) zval_ptr_dtor(arg2);
+ if (delim_needs_dtor) FREE_ZVAL(delim);
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php