[Phpslash-devel] stripBadHTML bug - well kinda
Brought to you by:
joestewart,
nhruby
From: Mike G. <mi...@op...> - 2003-07-19 19:22:47
|
Hello, The bug with stripBadHTML is that it doesn't manage one user error that a client of mine stumbled across. <br><a href="link>1missing last</a> - Missing the last quote here <br><a href="link">2fine</a> - Messes up this quote here I'm not the best at regular expressions, but I would think that it would be possible to check that both ""'s are present: $str = eregi_replace("<a([^>]*)href=\"?([^\"]*)\"?([^>]*)>", "<a href=\\2>", $str); It's waiting for the final " (which in this case the user forgot). It should look for either the final " or a final > (whichever comes first). I would think that this would do it: $str = eregi_replace("<a([^>]*)href=\"?([^\"]*)[\"|>]?([^>]*)>", "<a href=\\2>", $str); But I haven't gotten it to work just right... I know this isn't something that many folks are likely to do, but for this type of interface it's good to correct simple typos if you can.. Mike -- Mike Gifford, OpenConcept Consulting Free Software for Social Change -> http://www.openconcept.ca Site Launch - Make Every Vote Count - http://www.fairvotecanada.org The cruelest lies are often told in silence. -- Robert L Stevenson |