FAQ | This is a LIVE service | Changelog

Skip to content

Avoid calling pg_last_error when no connection

Dr Catherine Pitt requested to merge maths into master

If the user fails to make a connection to the database, usually because of a wrong password, then the code tries to print the results of pg_last_error() and then 'Unable to connect'. But pg_last_error() won't work when there's no connection. In PHP before 8.1 it failed silently, but since 8.1 it prints an ugly error message across the screen.

This change removes the call to pg_last_error in the dbBase dbConnect() method.

Merge request reports