|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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:
 [2006-05-01 15:15 UTC] idiom at mail dot ru
var_export() outputs \0 in variables as is, messing browser

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

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-01 16:10 UTC]
I'll have a look
 [2006-07-22 12:33 UTC]
Derick, still looking?
 [2006-10-09 18:09 UTC]
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
Thank you for the report, and for helping us make PHP better.

 [2007-12-09 14:31 UTC]
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.
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 23:01:32 2015 UTC