MantisBT: master dcc19f49

Author Committer Branch Timestamp Parent
dregad dregad master 2012-07-04 03:39 master 26b38801
Affected Issues  0014447: URLs longer than 152 characters are causing problems
Changeset

Fix long URL formatting causing bugnote/text to be blank

When MantisCoreFormatting plugin processes text (e.g. bugnote)
containing a long URL, a PREG_BACKTRACK_LIMIT_ERROR may occur in
string_insert_hrefs() when replacing email address links with
preg_replace_callback(). When pcre.backtrack_limit = 100000, the longest
URL that can be processed successfully is 152 chars. A bigger URL
triggers the PCRE error and the function returns NULL.

This was introduced by commit 01b5bf55a1dae4225a083cca16edf208bb10c4b1.

We now use preg_split() instead of preg_replace_callback(), which is
more efficient and avoids the backtrace error issue

The url replacement string was also moved to a variable to make code
more readable.

Fixes 0014447

mod - core/string_api.php Diff File