MantisBT: master-1.2.x 38ef3244

Author Committer Branch Timestamp Parent
dregad dregad master-1.2.x 2012-07-04 03:39 master-1.2.x adc66fea
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 21a3469d1039c21fbf52796f23a95ab18856254a.

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