silverstripe/silverstripe-framework — pull request #2924 by tractorcow (2014-03-05 02:28:58+00:00)
Title: Rewrote usages of error suppression operator

There are several places in the code where the error suppression operator has been used, mostly unnecessarily, especially to provide a shortcut for safely accessing array-indexed elements that may not be set.

The problem with this approach is that, even though errors aren't reported immediately, they are still raised behind the scenes. Not only is this a performance issue, but it also pollutes the result of `error_get_last` with messages where no error has actually occurred. This is actually where I found these to be an issue, as I was writing an application that had to detect and respond to errors in the error control loop.

In most cases isset and empty was sufficient to safely determine array accessed values. `HTMLValue::setContent` was rewritten using some information I found at http://stackoverflow.com/questions/7082401/avoid-domdocument-xml-warnings-in-php

There are still places that the operator is used, specifically in third party modules (which are mostly not covered by test cases) and file access methods, which were troublesome to rewrite safely without the error suppression.

This will be ported up to 3.1 in a separate PR, since some of the API has changed in 3.1.