silverstripe/sapphire — pull request #1129 by tractorcow (2013-01-23 22:54:43+00:00)
Title: API + BUG HTTP::absoluteURLs behaving incorrectly / using unsafe code

HTTP::absoluteURLs incorrectly replaced links with garbage code, related to https://github.com/silverstripe/sapphire/commit/c56a80d6ce5294a5339fb45d62bccf45cc5dcdc3

Additionally, the previous code relied on code embedded within a string being evaluated by the regular expression function, which is not recommended current php practise.

There were also some other cases that were not correctly handled by the function, such as css attributes with various quoting styles. Test cases were added to HTTPTest to cover these, and appropriate fixes applied.

PHPDoc has also been improved significantly.

In order to fix the above issues but maintain compatibility with the current API as at SS 3.1 I have created a fix using php eval(), but have added a deprecation message if running at 3.2 or above. The function has been extended to support being given a callable as an expression instead.

The fixed function also simply uses Director::absoluteURL rather than attempting to re-implement the functionality inline.

I'm not sure if this should be comitted to 3.1 or master, as it contains both a bugfix and a slight API extension.