PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_BBCodeParser » Bug #373

URL's with '&' are parsed incorrectly

Details

Submitted2003-12-07 22:27 UTC
Frompearbbcodeparser at borfast dot com
Assigneddufuz
StatusClosed
PackageHTML_BBCodeParser
PHP VersionIrrelevant
OSLinux (shouldn't really matter)
Roadmaps(Not assigned)

Comments

[2003-12-07 22:27 UTC] pearbbcodeparser at borfast dot com

Description:
------------
A BBCode link with a '&' in it will not be correctly transformed into it's HTML equivalent.

Reproduce code:
---------------
Note that this is not PHP code but "BBCode" used by this package.
The following BBCode will not be handled correctly:
[url=http://domain.com/index.php?i=1&j=2]linked text[/url]

Expected result:
----------------
<a href="http://domain.com/index.php?i=1&j=2">linked text</a>

Actual result:
--------------
<a>linked text</a>

[2003-12-07 22:30 UTC] pearbbcodeparser at borfast dot com

Edited the version information (had PHP version before)

[2003-12-07 22:36 UTC] pearbbcodeparser at borfast dot com

OK, so 'version' is PHP's version after all... sorry, I'm new here ;)

[2004-01-11 10:25 UTC] sjr at php dot net

I can't seem to reproduce this.
Input code:
------------
normal link: [url=http://domain.com/index.php?i=1&j=2]linked text[/url]
auto link: http://domain.com/index.php?i=1&j=2

Output code:
------------
normal link: <a href='http://domain.com/index.php?i=1&j=2'>linked text</a>
auto link: <a href='http://domain.com/index.php?i=1&j=2'>http://domain.com/index.php?i=1&j=2</a>

[2004-01-11 11:57 UTC] pearbbcodeparser at borfast dot com

Could it have something to do with the fact that my system is set to UTF-8?

I don't think so but it's the only thing that comes to my mind.

Can someone else try to reproduce it and post the results here? Thanks.

[2005-10-20 21:54 UTC] seth at pricepages dot org

I've fixed this bug and a number of others. Please take a
look if you can, because I'd expect there to be new bugs in
a rewrite of this size. (I'd call it version 2.0-beta)

Link:
http://pricepages.org/bbcode/BBCodeParser.zip

* Unit tests!

* More currently open bugs that have been fixed:
5609
4844
3447
1979
373
2580
3775

* I rewrote the _buildTagArray() function. It had been using
half of the execution time in my tests. A TODO: in the
comments said "rewrite this function". It is now almost 2x
faster than the original function in my informal tests.

* I rewrote _validateTagArray() in an effort to make it more
useful and faster. Mission accomplished. It would be easier
to read, too, but there is quite
a bit more going on there. But commenting lines probably
equal code lines.

* Output should _always_ be XHTML 1.1 compatible.

* Per discussion on the Developer list, you can now pass a
flag that determines the action on an error or warning
during parsing. Actions include: correcting the problem,
aborting parsing, ignoring the invalid tag, and deleting the
invalid tag.

Examples:
If you only accept valid input, set both warn and error to
'abort' and parsing will be aborted as soon as a problem is
found.
If you accept invalid feedback, but want to give the user
feedback which tags caused problems, then set both error and
warn to 'ignore' and the bad tags will be displayed.
If you want to make the output as pretty as possible, then
you want to auto correct when you can and delete when you
can't. Set the options to delete on error, and correct on
warn.
(There are twelve combinations to fit various situations.)

* I've attempted to maximize BC, but here are the only ways
in which BC is broken (to my knowledge):

Custom list numbering is now ignored for XHTML 1.1 reasons.
I reverted back to single quotes by default. HTML is now
automatically escaped to fix a few "bugs" (I believe that
Text_Wiki also automatically escapes HTML). Old filters are
incompatible with the new filters (the 'allowed' tag
variable has been replaced with a more powerful set of
variables and they use a different format).

~Seth