This particularly fixes two tests (bug66356.phpt and bug72339.phpt) if PHP has been build with an external libgd.
There's no need anymore to call an own error handler directly. Instead we register our error handler and call libgd's error functions (which will forward). We do this regardless of compiling with the bundled or an external libgd.