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

Bug #7091 Variable Substitution Bug
Submitted: 2006-03-10 18:09 UTC
From: randlem at bgsu dot edu Assigned: toggg
Status: Closed Package: Text_Wiki (version 1.1.0)
PHP Version: 5.1.1 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-03-10 18:09 UTC] randlem at bgsu dot edu (Mark Randles)
Description: ------------ In the LaTeX render classes for both wikilink and freelink (and most likely others) variable substitution is used to insert the values into the formatted string. This is unsafe as it inserts an extra \ which masks a { and latex cannot match the next } correctly. A more correct (or at least safer) version should use concatination to build the return string. Affects (at least): Render/Latex/Wikilink.php Render/Latex/Freelink.php Test script: --------------- $text = 'foobar'; $href = 'http://www.example.com/wiki?id=foobar'; return "$text\\footnote\{$href}"; A safer version: return $text. '\\footnote{'. $href. '}'; Expected result: ---------------- foobar\footnote{http://www.example.com/wiki?id=foobar} Actual result: -------------- foobar\footnote\{http://www.example.com/wiki?id=foobar}

Comments

 [2006-03-10 18:33 UTC] toggg
I would not say "unsafe" but wrong. However, this is not (or should not be) related to the variable replacement. I guess the intention was: return "$text\\footnote\{{$href}}"; However, return $text. '\\footnote{'. $href. '}'; should be simpler and quicker. :) Some review to do, I guess.
 [2006-03-11 11:14 UTC] toggg
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.