From: Felipe Pena Date: Wed, 4 Aug 2010 23:11:44 +0000 (+0000) Subject: - Fixed bug #52534 (var_export array with negative key) X-Git-Tag: php-5.4.0alpha1~191^2~1149 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d2a6927c7f6b5da71e10b74584a72e74e47e6df;p=php - Fixed bug #52534 (var_export array with negative key) --- diff --git a/ext/standard/tests/array/bug52534.phpt b/ext/standard/tests/array/bug52534.phpt new file mode 100644 index 0000000000..dfff3fdb4f --- /dev/null +++ b/ext/standard/tests/array/bug52534.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #52534 (var_export array with negative key) +--FILE-- + 'Hello'); + +var_export($aArray); + +?> +--EXPECT-- +array ( + -1 => 'Hello', +) diff --git a/ext/standard/var.c b/ext/standard/var.c index d0482f0d95..3e3b8eb163 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -353,7 +353,7 @@ static int php_array_element_export(zval **zv TSRMLS_DC, int num_args, va_list a if (hash_key->nKeyLength == 0) { /* numeric key */ buffer_append_spaces(buf, level+1); - smart_str_append_long(buf, hash_key->h); + smart_str_append_long(buf, (long) hash_key->h); smart_str_appendl(buf, " => ", 4); } else { /* string key */