Fixes for PHP 5.3.

+ Incorrect variable and class contexts.
+ Retrieving element of array returned from function directly, without local variable.
Merge pull request #115 from leftclickben/PROV-913_FixesForPhp53

PROV-913: Fixes for PHP 5.3