diff options
author | Zeev Suraski <zeev@php.net> | 2001-08-14 15:24:20 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-08-14 15:24:20 +0000 |
commit | f72d907105f648de3d0d3384b0aa0aa4e87da622 (patch) | |
tree | 3cca966a7c20961b5f1e5418a622558720285235 /Zend/zend_variables.c | |
parent | ac0bee7ec96aa7a5a2294681f442e189baa7548d (diff) | |
download | php-git-f72d907105f648de3d0d3384b0aa0aa4e87da622.tar.gz |
MFZE1
Diffstat (limited to 'Zend/zend_variables.c')
-rw-r--r-- | Zend/zend_variables.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 757019860c..f919fb8c85 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -126,6 +126,40 @@ ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) } +ZEND_API int zval_persist(zval *zvalue TSRMLS_DC) +{ + switch (zvalue->type) { + case IS_RESOURCE: + return FAILURE; /* resources cannot be persisted */ + break; + case IS_BOOL: + case IS_LONG: + case IS_NULL: + break; + case IS_CONSTANT: + case IS_STRING: + if (zvalue->value.str.val) { + if (zvalue->value.str.len==0) { + zvalue->value.str.val = empty_string; + return SUCCESS; + } + } + persist_alloc(zvalue->value.str.val); + break; + case IS_ARRAY: + case IS_CONSTANT_ARRAY: + persist_alloc(zvalue->value.ht); + zend_hash_apply(zvalue->value.ht, (apply_func_t) zval_persist TSRMLS_CC); + break; + case IS_OBJECT: + persist_alloc(zvalue->value.obj.properties); + zend_hash_apply(zvalue->value.obj.properties, (apply_func_t) zval_persist TSRMLS_CC); + break; + } + return SUCCESS; +} + + ZEND_API int zend_print_variable(zval *var) { return zend_print_zval(var, 0); |