|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42272 var_export() incorrectly escapes char(0)
Submitted: 2007-08-11 15:50 UTC Modified: 2007-12-18 10:55 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: pilots at rambler dot ru Assigned:
Status: Closed Package: Variables related
PHP Version: 5.2.4RC1 OS: WindowsXP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 - 5 = ?
Subscribe to this entry?

 [2007-08-11 15:50 UTC] pilots at rambler dot ru
var_export() incorrectly escapes char(0) in strings. It returns '\000' in single quotes, therefore then this string can not be imported correctly.

Reproduce code:
eval('echo '.var_export("\0",true).';');

Expected result:
// chr(0)

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-09 16:55 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-17 13:39 UTC]
There is still an issue, with array keys and \0
 [2007-12-18 10:55 UTC]
Fixed now.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Mar 05 00:01:23 2021 UTC