var_export() does not escape \0 character

Bug #37262 var_export() does not escape \0 character
Submitted: 2006-05-01 15:15 UTC Modified: 2007-12-09 14:31 UTC
From: idiom at mail dot ru Assigned:
Status: Closed Package: Variables related
PHP Version: 5.1.3, 4.4.2 OS: Windows
Private report: No CVE-ID: None

 [2006-05-01 15:15 UTC] idiom at mail dot ru

Description:
------------
var_export() outputs \0 in variables as is, messing browser

Reproduce code:
---------------
$func = create_function('$a', 'return $a;');
var_export($func);

Expected result:
----------------
identical to:
$func = create_function('$a', 'return $a;');
$output = addcslashes(var_export($func, true), "\0");
echo $output;



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2006-10-09 18:09 UTC] iliaa@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2007-12-09 14:31 UTC] derick@php.net

This was fixed improperly, as the resulting output could not be parsed back to its original string. A fix for this is in PHP 5.2.6/5.3.0/6.0.0.