Fix for $this in anonymous functions prior to PHP 5.4