Fix for PHP 5.3

PHP 5.3 does not handle $this in closures, so we have to pass it through
another variable.