felipe                                   Wed, 04 Aug 2010 23:11:44 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=301863

Log:
- Fixed bug #52534 (var_export array with negative key)

Bug: http://bugs.php.net/52534 (Open) var_export array with negative key
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    A   php/php-src/branches/PHP_5_3/ext/standard/tests/array/bug52534.phpt
    U   php/php-src/branches/PHP_5_3/ext/standard/var.c
    A   php/php-src/trunk/ext/standard/tests/array/bug52534.phpt
    U   php/php-src/trunk/ext/standard/var.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-08-04 20:59:18 UTC (rev 301862)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-08-04 23:11:44 UTC (rev 301863)
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2010, PHP 5.3.4
+- Fixed bug #52534 (var_export array with negative key). (Felipe)
 - Fixed bug #52508 (newline problem with parse_ini_file+INI_SCANNER_RAW).
   (Felipe)
 - Fixed bug #52487 (PDO::FETCH_INTO leaks memory). (Felipe)

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/array/bug52534.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/array/bug52534.phpt         
                (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/array/bug52534.phpt 
2010-08-04 23:11:44 UTC (rev 301863)
@@ -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',
+)


Property changes on: 
php/php-src/branches/PHP_5_3/ext/standard/tests/array/bug52534.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/ext/standard/var.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/var.c     2010-08-04 20:59:18 UTC 
(rev 301862)
+++ php/php-src/branches/PHP_5_3/ext/standard/var.c     2010-08-04 23:11:44 UTC 
(rev 301863)
@@ -353,7 +353,7 @@

        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 */
                char *key, *tmp_str;

Added: php/php-src/trunk/ext/standard/tests/array/bug52534.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/array/bug52534.phpt                    
        (rev 0)
+++ php/php-src/trunk/ext/standard/tests/array/bug52534.phpt    2010-08-04 
23:11:44 UTC (rev 301863)
@@ -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',
+)


Property changes on: php/php-src/trunk/ext/standard/tests/array/bug52534.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/ext/standard/var.c
===================================================================
--- php/php-src/trunk/ext/standard/var.c        2010-08-04 20:59:18 UTC (rev 
301862)
+++ php/php-src/trunk/ext/standard/var.c        2010-08-04 23:11:44 UTC (rev 
301863)
@@ -353,7 +353,7 @@

        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 */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to