Edit report at https://pear.php.net/bugs/bug.php?id=12187&edit=1
ID: 12187
Updated by: [email protected]
Reported By: arjan at webpower dot nl
Summary: Quote recognition in parser is broken
-Status: Open
+Status: Closed
Type: Bug
Package: HTML_BBCodeParser
Operating System: Linux
Package Version: 1.2.2
PHP Version: 5.2.3
-Assigned To:
+Assigned To: doconnor
Roadmap Versions:
New Comment:
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: doconnor
This bug has been fixed in SVN.
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.
Previous Comments:
------------------------------------------------------------------------
[2007-10-05 06:01:59] avoid
Description:
------------
The BBcode parser doesn't handle quotes (") around
attribute values correctly. If the attribute value contains
a space, things go awry.
I applied a simple patch to BBCodeParser.php, which fixes
the problem. Can somebody review this patch and, if found
okay, apply it to the source?
Line 459: removed a \s from the regexp:
Old: $regex = "=(\"[^\s$ce]+\"|[^\s$ce]";
New: $regex = "=(\"[^$ce]+\"|[^\s$ce]";
Line 463: Added the U pattern modifier, to make the regexp ungreedy.
Old: $regex .= "+)(?=[\s$ce])!i";
New: $regex .= "+)(?=[\s$ce])!iU";
Test script:
---------------
This is a line of text.
[url="http://www.example.com" title="this is a title"]
In this case, when trying to use the 'title' attribute,
it's value will be ""test" (with a leading quote).
Expected result:
----------------
Of course, the 'title' attribute should contain the value
"this is a test" (without the quotes).
------------------------------------------------------------------------