]> granicus.if.org Git - php/commitdiff
- Fixed bug #52534 (var_export array with negative key)
authorFelipe Pena <felipe@php.net>
Wed, 4 Aug 2010 23:11:44 +0000 (23:11 +0000)
committerFelipe Pena <felipe@php.net>
Wed, 4 Aug 2010 23:11:44 +0000 (23:11 +0000)
ext/standard/tests/array/bug52534.phpt [new file with mode: 0644]
ext/standard/var.c

diff --git a/ext/standard/tests/array/bug52534.phpt b/ext/standard/tests/array/bug52534.phpt
new file mode 100644 (file)
index 0000000..dfff3fd
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Bug #52534 (var_export array with negative key)
+--FILE--
+<?php
+
+$aArray = array ( -1 => 'Hello');
+
+var_export($aArray);
+
+?>
+--EXPECT--
+array (
+  -1 => 'Hello',
+)
index d0482f0d955a3b6b589ab5142e4b01e3a3079359..3e3b8eb163b20e80591300e4f3bc07868fc7e19f 100644 (file)
@@ -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 */