That happens because the external libgd uses other error codes than PHP
(and the bundled libgd), but the libgd error codes are simply forwarded
to php_verror(). We fix that by properly mapping libgd errors to PHP errors.
#endif
#include <gd.h>
+#ifndef HAVE_GD_BUNDLED
+# include <gd_errors.h>
+#endif
#include <gdfontt.h> /* 1 Tiny font */
#include <gdfonts.h> /* 2 Small font */
#include <gdfontmb.h> /* 3 Medium bold font */
{
TSRMLS_FETCH();
+ switch (type) {
+ case GD_DEBUG:
+ case GD_INFO:
+ case GD_NOTICE:
+ type = E_NOTICE;
+ break;
+ case GD_WARNING:
+ type = E_WARNING;
+ break;
+ default:
+ type = E_ERROR;
+ }
php_verror(NULL, "", type, format, args TSRMLS_CC);
}
/* }}} */