diff options
author | Felipe Pena <felipe@php.net> | 2010-08-04 23:11:44 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2010-08-04 23:11:44 +0000 |
commit | 3d2a6927c7f6b5da71e10b74584a72e74e47e6df (patch) | |
tree | 69eb926652167397431a72b83ecaade5e5c23525 | |
parent | fa27ef4620f197b32ba8622a0499679f1d428875 (diff) | |
download | php-git-3d2a6927c7f6b5da71e10b74584a72e74e47e6df.tar.gz |
- Fixed bug #52534 (var_export array with negative key)
-rw-r--r-- | ext/standard/tests/array/bug52534.phpt | 14 | ||||
-rw-r--r-- | ext/standard/var.c | 2 |
2 files changed, 15 insertions, 1 deletions
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-- +<?php + +$aArray = array ( -1 => '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 */ |