View Issue Details

IDProjectCategoryView StatusLast Update
0035210mantisbtuipublic2025-01-11 08:42
Reporterraspopov Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.28.0 
Target Version2.28.0Fixed in Version2.28.0 
Summary0035210: Incorrect handling of relative URLs in helper_get_root_domain() function and caller one
Description

If you specify, for example, a relative link in an image markdown, you will get the following message:

DEPRECATED: 'explode(): Passing null to parameter #2 ($string) of type string is deprecated' in 'core\helper_api.php' line 930

Because of the way this function is used, it's not easy to figure out how to fix it.

Steps To Reproduce

Insert this markdown link in the input field:

![alt](/favicon.ico)
Additional Information

Branch: master

TagsNo tags attached.

Relationships

related to 0005271 resolvedcommunity Support NoFollow hyperlinks for external urls 

Activities

Related Changesets

MantisBT: master 40f71cf3

2024-12-29 08:49

dregad


Details Diff
Fix nofollow attribute for relative URLs

Extract duplicated code in MantisMarkdown::processUrl() and the callback
in string_insert_hrefs() into a new helper_is_link_external() function.

Add logic to treat relative URLs as internal.

Fixes 0035210
Follow-up on issue 0005271, PR https://github.com/mantisbt/mantisbt/pull/2044
Affected Issues
0005271, 0035210
mod - core/helper_api.php Diff File
mod - core/string_api.php Diff File
mod - plugins/MantisCoreFormatting/core/MantisMarkdown.php Diff File

MantisBT: master 9cb002ec

2024-12-29 19:20

dregad


Details Diff
Add tests for external URLs and nofollow

- testLinkIsExternal: checks that helper_is_link_external() correctly
detects external URLs.
- testNoFollow: verifies that helper_get_link_attributes() sets the
nofollow attribute (LINKS_NOFOLLOW_EXTERNAL) as appropriate for
internal and external links.

Issue 0035210
Affected Issues
0035210
mod - tests/Mantis/Helper/GetLinkAttributesTest.php Diff File