Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.0a3

Bug #3572 Use of addslashes() adds too much backslashes
Submitted: 2005-02-24 09:59 UTC
From: bluem at gmx dot de Assigned: aidan
Status: Closed Package: PHP_Compat
PHP Version: Irrelevant OS: Any (reprod.: Linux, Mac OS X)
Roadmaps: 1.6.0a1    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2006-12-27 05:05 UTC
Package:
Bug Type:
Summary:
From: bluem at gmx dot de
New email:
PHP Version: Package Version: OS:

 

 [2005-02-24 09:59 UTC] bluem at gmx dot de
Description: ------------ This bug affects the implementation of var_export() in the latest PHP_Compat version (4.3.1). Problem: Strings are quoted using $stringdelim, but nevertheless escaping is done with addslashes(). This results in double quotes being escaped with a backslash, although no backslash would be necessary. Solution: It should suffice to exchange the two occurrences of addslashes() with the following code: str_replace($stringdelim, '\\'.$stringdelim, $value) Reproduce code: --------------- echo "<pre>"; print_r(var_export('Hello "Foo" World')); echo "</pre>\n"; Expected result: ---------------- 'Hello "Foo" World' Actual result: -------------- 'Hello \"Foo\" World'

Comments

 [2005-02-28 08:47 UTC] aidan
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. I found a number of other problems, they're all fixed now. Diff: http://cvs.php.net/diff.php/pear/PHP_Compat/Compat/Function/var_export.php?r1=1.11&r2=1.12&ty=u