php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60050 var_export should not add space at end of line
Submitted: 2011-10-13 08:45 UTC Modified: 2015-03-16 07:41 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jerome at despatis dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.8 OS: Ubuntu - Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jerome at despatis dot com
New email:
PHP Version: OS:

 

 [2011-10-13 08:45 UTC] jerome at despatis dot com
Description:
------------
With an array that contains an array, the var_export adds an extra space at end of line

=> It forces post treatment to suppress those extra spaces, before saving output to a file

As spaces at end of line is not a recommended practice...

Test script:
---------------
<?php
  $test = array('string' =>array('foo'));
  var_export($test);
?>


Expected result:
----------------
array (
  'string' =>// <= the line should end with '=>', and not with a space e.g '=> '
  array (
    0 => 'foo',
  ),
)

Actual result:
--------------
array (
  'string' => // <= there's a space after the '=>' symbol
  array (
    0 => 'foo',
  ),
)

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-16 07:41 UTC] demon@php.net
-Status: Open +Status: Not a bug
 [2015-03-16 07:41 UTC] demon@php.net
I don't think it's a bug and seems the patch will produce a lot of BC breaks.
Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 16:01:33 2025 UTC