com php-src: Fix #70315: 500 Server Error but page is fully rendered: ext/gd/gd.c

From: Date: Mon, 18 Jul 2016 22:18:07 +0000
Subject: com php-src: Fix #70315: 500 Server Error but page is fully rendered: ext/gd/gd.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93084@lists.php.net to get a copy of this message
Commit: 6cb75fb1e8208d79f58351340923059d0d077ee6 Author: Christoph M. Becker <cmbecker69@gmx.de> Thu, 7 Jul 2016 14:47:55 +0200 Parents: 8b905e337c0e88ec66a25e4b7dbbd5c87279ea75 Branches: PHP-5.6 PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6cb75fb1e8208d79f58351340923059d0d077ee6 Log: Fix #70315: 500 Server Error but page is fully rendered 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. Bugs: https://bugs.php.net/70315 Changed paths: M ext/gd/gd.c Diff: diff --git a/ext/gd/gd.c b/ext/gd/gd.c index cb070ab..d811464 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -69,6 +69,9 @@ static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC); #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 */ @@ -1099,6 +1102,18 @@ void php_gd_error_method(int type, const char *format, va_list args) { 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); } /* }}} */

« previous php.cvs (#93084) next »