Improved error handling and fixed some broken design issues with haxe-php.