MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012781mantisbtbugtrackerpublic2011-02-17 06:052013-04-06 09:23
Reporterzalex 
Assigned Todregad 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version1.2.11Fixed in Version1.2.11 
Summary0012781: Links in the comments look broken
DescriptionExample:

https://test:test@example.com/test [^]

Tags2.0.x check
Attached Files

- Relationships
related to 0015721new Functionality to consider porting to master-2.0.x 
related to 0014447closeddregad URLs longer than 152 characters are causing problems 

-  Notes
User avatar (0028250)
zalex (reporter)
2011-02-17 06:05

Just a test:
https://test:test@example.com/test [^]
User avatar (0031810)
dregad (developer)
2012-05-11 05:06
edited on: 2012-05-11 05:13

This is caused by the call to string_insert_hrefs() which replaces URLs and e-mails by hrefs when config option $g_html_make_links is ON.

The code first processes the URL, then the e-mail, so we have:

1. original string:
https:\\test:test_AT_example.com\test

2. call preg_replace for URL:
< a href="https:\\test:test_AT_example.com/test">https:\\test:test_AT_example.com/test</a>

3. call preg_replace for email:
< a href="https:\\test:test_AT_example.com/test">https:\\test:< a href="mailto:test_AT_example.com">test_AT_example.com</a>/test</a>


Note: to prevent the code from messing with the example above, "@" has been replaced by "_AT_", "//" by "\\" and a space added between < and a in the anchor tag

It is worth mentioning that in 1.3.x, this actually a major issue as it completely prevents rendering of the view issue details page and causes an error to occur (XML Parsing Error: not well-formed) due to of invalid HTML generation.

As a workaround, you can
a) set $g_html_make_links is ON
b) edit the URL to remove the "@" as I've done above

User avatar (0036248)
grangeway (developer)
2013-04-05 17:57

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

- Related Changesets
MantisBT: master 01b5bf55
Timestamp: 2012-05-11 06:08:48
Author: dregad
Details ] Diff ]
Fix string_insert_hrefs() to handle URLs with user/password

This function inserts the hrefs in 2 steps: 1) URLs and 2) emails.

When the string contains URLs specifying a username and/or password,
e.g. http://user@example.com/ [^] or http://user:password@example.com/ [^]
the 2nd call to pcre_replace() processes the part of it that matches the
email address specification, resulting in broken links and text display
as well as invalid HTML generation.

This commit fixes the behavior by adding logic to distinguish URLs with
password and actual emails addresses.

Fixes 0012781
mod - core/string_api.php Diff ] File ]
MantisBT: master-1.2.x 21a3469d
Timestamp: 2012-05-11 06:08:48
Author: dregad
Details ] Diff ]
Fix string_insert_hrefs() to handle URLs with user/password

This function inserts the hrefs in 2 steps: 1) URLs and 2) emails.

When the string contains URLs specifying a username and/or password,
e.g. http://user@example.com/ [^] or http://user:password@example.com/ [^]
the 2nd call to pcre_replace() processes the part of it that matches the
email address specification, resulting in broken links and text display
as well as invalid HTML generation.

This commit fixes the behavior by adding logic to distinguish URLs with
password and actual emails addresses.

Backport of 1.3.x commit f460bbd253e228753360e72984c5ac878b4e553e
Uses create_function() for preg_replace_callback instead of an Anonymous
function, as they are not supported in PHP < 5.3.

Fixes 0012781
mod - core/string_api.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2011-02-17 06:05 zalex New Issue
2011-02-17 06:05 zalex Note Added: 0028250
2012-05-11 05:06 dregad Note Added: 0031810
2012-05-11 05:06 dregad Assigned To => dregad
2012-05-11 05:06 dregad Status new => confirmed
2012-05-11 05:09 dregad Note Edited: 0031810 View Revisions
2012-05-11 05:10 dregad Note Edited: 0031810 View Revisions
2012-05-11 05:11 dregad Note Edited: 0031810 View Revisions
2012-05-11 05:13 dregad Note Edited: 0031810 View Revisions
2012-05-11 09:33 dregad Status confirmed => assigned
2012-05-11 09:33 dregad Target Version => 1.2.11
2012-05-11 10:00 dregad Changeset attached => MantisBT master 01b5bf55
2012-05-11 10:00 dregad Changeset attached => MantisBT master-1.2.x 21a3469d
2012-05-11 10:00 dregad Status assigned => resolved
2012-05-11 10:00 dregad Resolution open => fixed
2012-05-11 10:00 dregad Fixed in Version => 1.2.11
2012-06-06 23:53 jreese Status resolved => closed
2012-07-04 12:09 dregad Relationship added related to 0014447
2013-04-05 17:57 grangeway Status closed => acknowledged
2013-04-05 17:57 grangeway Note Added: 0036248
2013-04-05 18:37 grangeway Relationship added related to 0015721
2013-04-06 03:40 dregad Status acknowledged => closed
2013-04-06 07:23 grangeway Status closed => acknowledged
2013-04-06 09:22 dregad Tag Attached: 2.0.x check
2013-04-06 09:23 dregad Status acknowledged => closed


MantisBT 1.2.16dev master-1.2.x-05091f5 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.0876 seconds.
memory usage: 2,853 KB
Powered by Mantis Bugtracker