diff options
author | Derick Rethans <derick@php.net> | 2002-10-11 13:49:20 +0000 |
---|---|---|
committer | Derick Rethans <derick@php.net> | 2002-10-11 13:49:20 +0000 |
commit | e06550f85314a535d09fedcef795634bff0c30e5 (patch) | |
tree | 77fc8d7d016f60df8c456a60961c3998061edf96 /ext | |
parent | edc755aa549058e169284da7c72b21e73a6ccbb7 (diff) | |
download | php-git-e06550f85314a535d09fedcef795634bff0c30e5.tar.gz |
- Fix problem with var_export when objects with numeric indexes were
exported. We now skip those, as there is no way to export valid code for
it.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/standard/tests/array/var_export.phpt | 14 | ||||
-rw-r--r-- | ext/standard/var.c | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/ext/standard/tests/array/var_export.phpt b/ext/standard/tests/array/var_export.phpt new file mode 100644 index 0000000000..6d18f6065a --- /dev/null +++ b/ext/standard/tests/array/var_export.phpt @@ -0,0 +1,14 @@ +--TEST-- +var_export() and objects with numeric indexes properties +--POST-- +--GET-- +--INI-- +--FILE-- +<?php +$a = (object) array (1, 3, "foo" => "bar"); +var_export($a); +?> +--EXPECT-- +class stdClass { + var $foo = 'bar'; +} diff --git a/ext/standard/var.c b/ext/standard/var.c index 7b6e123396..bd42dc63b0 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -272,9 +272,9 @@ static int php_object_element_export(zval **zv, int num_args, va_list args, zend if (hash_key->nKeyLength != 0) { php_printf("%*cvar $%s = ", level + 1, ' ', hash_key->arKey); + php_var_export(zv, level + 2 TSRMLS_CC); + PUTS (";\n"); } - php_var_export(zv, level + 2 TSRMLS_CC); - PUTS (";\n"); return 0; } |