|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25758 var_export fails to escape quotes
Submitted: 2003-10-06 07:15 UTC Modified: 2003-10-07 21:15 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: hiroki at asakawa dot net Assigned:
Status: Closed Package: Variables related
PHP Version: 4.3.3 OS: Widows2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: hiroki at asakawa dot net
New email:
PHP Version: OS:


 [2003-10-06 07:15 UTC] hiroki at asakawa dot net
Using var_export, single quotes in keys are not be escaped.

Reproduce code:
$test = array( "quote'" => array( "quote'" ) );
echo var_export($test,true);

Expected result:
array ( 'quote\'' => array ( 0 => 'quote\'', ), )

Actual result:
array ( 'quote'' => array ( 0 => 'quote\'', ), )


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-06 16:11 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

This is expected behaviour.
 [2003-10-07 07:26 UTC] hiroki at asakawa dot net says
> It is similar to var_dump() with the exception that the 
> returned representation is valid PHP code. 
But above code does not generate valid PHP code.
Isn't it a bug?
 [2003-10-07 21:15 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 18:01:34 2024 UTC