php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #68979 var_export generates useless empty string
Submitted: 2015-02-03 14:37 UTC Modified: 2018-10-02 11:09 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: chris dot kde at gmail dot com Assigned:
Status: Wont fix Package: Variables related
PHP Version: 5.6.5 OS: 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: chris dot kde at gmail dot com
New email:
PHP Version: OS:

 

 [2015-02-03 14:37 UTC] chris dot kde at gmail dot com
Description:
------------
Hello,
var_export generates useless empty string in some specials cases (tested on 5.6.2)

Test script:
---------------
$data = "\0\0\0\0\0\0\0";
var_export($data);

echo "\n\n";

$data = "ok\0\0\0ab";
var_export($data);

Expected result:
----------------
"\0\0\0\0\0\0\0"

'ok' . "\0\0\0" . 'ab'

Actual result:
--------------
'' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . ''

'ok' . "\0" . '' . "\0" . '' . "\0" . 'ab'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-27 05:15 UTC] yohgaki@php.net
http://3v4l.org/hsMCN

Older PHP escaped NULL to \000.
 [2018-09-23 12:41 UTC] cmb@php.net
> Older PHP escaped NULL to \000.

However, that was wrong since it was a single-quoted string. This
issue had been reported as bug #42272, and fixed with commit
63dcbb7[1] and dc30b00[2], which introduced the overly verbose but
correct output.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=63dcbb73f0223f98c8666cee15e73a60891e0191>
[2] <http://git.php.net/?p=php-src.git;a=commit;h=dc30b0035d098b6e982c432c8d81919524f1d9fd>
 [2018-10-02 11:09 UTC] yohgaki@php.net
-Status: Open +Status: Wont fix
 [2018-10-02 11:09 UTC] yohgaki@php.net
Indeed. Won't fix would be appropriate.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 12:01:30 2024 UTC