Bug #52963 [Opn->Bgs]: var_export -1 array index outputs incorrectly

From: Date: Fri, 01 Oct 2010 02:40:28 +0000
Subject: Bug #52963 [Opn->Bgs]: var_export -1 array index outputs incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154798@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52963&edit=1

 ID:                 52963
 Updated by:         felipe@php.net
 Reported by:        kym at ausphotography dot net dot au
 Summary:            var_export -1 array index outputs incorrectly
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Strings related
 Operating System:   Linux Centos 5.5
 PHP Version:        5.2.14
 Block user comment: N

 New Comment:

Duplicated of Bug #52534, which has been already fixed. Thanks.


Previous Comments:
------------------------------------------------------------------------
[2010-10-01 04:35:11] kym at ausphotography dot net dot au

Description:
------------
Function var_export appears to not handle -ve array indexes and outputs
the unsigned value.

Sample below.

This is on a standard Linux hosted service.


Test script:
---------------
<?php
$stylecache = array ( 
-1 => array 
( 1 => array 
( 0 => array ( 'styleid' => '19', 'title' => 'vB4 efault
Style',
'parentid' => '-1', 'displayorder' => '1',
'userselect' => '1',  ),  ),
),
 19 => array (
 2 =>  array (  0 =>   array (  'styleid' => '20',  'title'
=>
'APintermGreen1',  'parentid' => '19',  'displayorder'
=> '2', 
'userselect' => '1',  ),  ),  
 ),
);

var_export($stylecache);
?>

Expected result:
----------------
$stylecache = array (
  -1 => 
  array (
    1 => 
    array (
      0 => 
      array (
        'styleid' => '19',
        'title' => 'vB4 Default Style',
        'parentid' => '-1',
        'displayorder' => '1',
        'userselect' => '1',
      ),
    ),
  ),
  19 => 
  array (
    2 => 
    array (
      0 => 
      array (
        'styleid' => '20',
        'title' => 'APintermGreen1',
        'parentid' => '19',
        'displayorder' => '2',
        'userselect' => '1',
      ),
    ),
  ),
);


Actual result:
--------------
$stylecache = array (
  4294967295 => 
  array (
    1 => 
    array (
      0 => 
      array (
        'styleid' => '19',
        'title' => 'vB4 Default Style',
        'parentid' => '-1',
        'displayorder' => '1',
        'userselect' => '1',
      ),
    ),
  ),
  19 => 
  array (
    2 => 
    array (
      0 => 
      array (
        'styleid' => '20',
        'title' => 'APintermGreen1',
        'parentid' => '19',
        'displayorder' => '2',
        'userselect' => '1',
      ),
    ),
  ),
);



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52963&edit=1


Thread (2 messages)

« previous php.bugs (#154798) next »