View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002154 | mantisbt | bugtracker | public | 2002-06-18 16:18 | 2014-10-02 18:21 |
| Reporter | rcarmo | Assigned To | grangeway | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| Summary | 0002154: HTML in news is rendered incorrectly | ||||
| Description | If an A tag (link) is inserted in a news item, the source "<a... etc." is rendered, with an incorrect link highlight. The string ends in ">;", which is wierd. | ||||
| Tags | No tags attached. | ||||
|
Using the latest CVS code I added a news item with a link to hotmail and it rendered fine. Is this what you are trying to do? Are you testing with the latest code or with 0.17.3? |
|
|
I couldn't get exactly the same problem but I got something similar by entering the anchor tags myself rather than letting mantis just spot the uri. The regexp's used in string_strip_hrefs() has a few problems:
<A href="http://www.w3.org/" charset="ISO-8859-1">W3C Web site</A> fails because of uppercase <a href="http://www.w3.org/" charset="ISO-8859-1">W3C Web site</a> still fails because of the charset attribute zzz<a href="http://www.w3.org/">W3C Web site</a>zzz fails due to non-whitespace This one works: <a href="http://www.w3.org/">W3C Web site</a> I've put the following at the top of string_strip_hrefs() to fix 3: ensure any anchor tags are followed by expected whitespace etc.$p_string = preg_replace( '/(<\/?a[^>]*>)(?!$|>|[\s\,>\n\r])/si', edited on: 04-19-03 16:46 |
|
|
I've applied the first two fixes... I'm not happy with your solution for the third so I need to think about it and see if I can come up with a better one |
|
|
The regexp in string_strip_hrefs has another problem: it recognizes only double-quoted href attributes, whereas single-quoted attributes are also legal. Here is a modified function, which is also more efficient (one call to preg_replace instead of two):
|
|
|
Why does the function decline to match anchors with subtags?
I see no reason why it shouldn't, in which case replace the
with
|
|
|
I'm resolving this issue as "no change required" - please do not hesitate to reopen the issue if you believe that this issue should still be looked into. We've been considering deprecating removing the news feature for a while. In addition, the string_api regex code has been rewritten/tweaked multiple times since 2002 and the descriptions entered into this tracker have been rendered so it makes it hard to understand the raw data. If there's still an issue here with the parsing can you: 1) Reopen and update this issue with a raw example that needs fixing Thanks |
|
|
MantisBT: master c2d87939 2003-04-22 11:42 Julian Fitzell Details Diff |
Fix a few bugs pointed out in issue 0002154 by bevindarkgun <bevindarkgun@yahoo.com> * core/string_api.php (html_strip_hrefs): + fix both regexes to use [^\>]*> instead of [^\"]* + make regex searches case insensitive to we pick up anchors with A as well as a, etc git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2157 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9 |
Affected Issues 0002154 |
|
| mod - core/string_api.php | Diff File | ||