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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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 23:01:33 2025 UTC