summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>1999-06-09 19:47:06 +0000
committerThies C. Arntzen <thies@php.net>1999-06-09 19:47:06 +0000
commita3464b7c1182526e3d25b7bf8d60cfab78a83581 (patch)
treee7c996a897eb7b4cb69302ff02a74b126dff360b /ext/standard/string.c
parent7ed492344126557e111e462675a5a4d93114ea0d (diff)
downloadphp-git-a3464b7c1182526e3d25b7bf8d60cfab78a83581.tar.gz
oci8 to 3.0.9
implode works!
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 139911c72d..bfc66735a9 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -306,7 +306,7 @@ PHP_FUNCTION(explode)
Join array elements placing glue string between items and return one string */
PHP_FUNCTION(implode)
{
- pval *arg1, *arg2, *delim, *tmp, *arr;
+ pval *arg1, *arg2, *delim, **tmp, *arr;
int len = 0, count = 0;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
@@ -329,9 +329,9 @@ PHP_FUNCTION(implode)
/* convert everything to strings, and calculate length */
_php3_hash_internal_pointer_reset(arr->value.ht);
while (_php3_hash_get_current_data(arr->value.ht, (void **) &tmp) == SUCCESS) {
- convert_to_string(tmp);
- if (tmp->type == IS_STRING) {
- len += tmp->value.str.len;
+ convert_to_string(*tmp);
+ if ((*tmp)->type == IS_STRING) {
+ len += (*tmp)->value.str.len;
if (count>0) {
len += delim->value.str.len;
}
@@ -346,9 +346,9 @@ PHP_FUNCTION(implode)
return_value->value.str.val[len] = '\0';
_php3_hash_internal_pointer_reset(arr->value.ht);
while (_php3_hash_get_current_data(arr->value.ht, (void **) &tmp) == SUCCESS) {
- if (tmp->type == IS_STRING) {
+ if ((*tmp)->type == IS_STRING) {
count--;
- strcat(return_value->value.str.val, tmp->value.str.val);
+ strcat(return_value->value.str.val, (*tmp)->value.str.val);
if (count > 0) {
strcat(return_value->value.str.val, delim->value.str.val);
}
@@ -356,6 +356,8 @@ PHP_FUNCTION(implode)
_php3_hash_move_forward(arr->value.ht);
}
return_value->type = IS_STRING;
+ return_value->refcount = 1;
+ return_value->is_ref = 0;
return_value->value.str.len = len;
}
/* }}} */