Fix PHP 5.2 errors in connection parameters.
Support nested exceptions (not supported in PHP <= 5.2).