1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00

Don't try to serialize references.

Circular references would otherwise kill PHP, as the serializer
would overrun the stack.
This commit is contained in:
Sascha Schumann
2000-09-29 18:48:40 +00:00
parent a68a224efd
commit 4b89b67d1c
+20 -18
View File
@@ -300,25 +300,27 @@ void php_var_serialize(pval *buf, pval **struc)
continue;
}
switch (i) {
case HASH_KEY_IS_LONG:
MAKE_STD_ZVAL(d);
d->type = IS_LONG;
d->value.lval = index;
php_var_serialize(buf, &d);
FREE_ZVAL(d);
break;
case HASH_KEY_IS_STRING:
MAKE_STD_ZVAL(d);
d->type = IS_STRING;
d->value.str.val = key;
d->value.str.len = strlen(key);
php_var_serialize(buf, &d);
efree(key);
FREE_ZVAL(d);
break;
if (!(*data)->is_ref) {
switch (i) {
case HASH_KEY_IS_LONG:
MAKE_STD_ZVAL(d);
d->type = IS_LONG;
d->value.lval = index;
php_var_serialize(buf, &d);
FREE_ZVAL(d);
break;
case HASH_KEY_IS_STRING:
MAKE_STD_ZVAL(d);
d->type = IS_STRING;
d->value.str.val = key;
d->value.str.len = strlen(key);
php_var_serialize(buf, &d);
efree(key);
FREE_ZVAL(d);
break;
}
php_var_serialize(buf, data);
}
php_var_serialize(buf, data);
}
}
STR_CAT(buf, "}", 1);