rasmus                                   Mon, 24 May 2010 23:27:39 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299725

Log:
Let's have a sane error message here instead of some cryptic zlib error

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c
    U   php/php-src/trunk/ext/gd/libgd/gd_png.c

Modified: php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c  2010-05-24 22:17:41 UTC 
(rev 299724)
+++ php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c  2010-05-24 23:27:39 UTC 
(rev 299725)
@@ -515,6 +515,10 @@
        /*  png_set_filter(png_ptr, 0, PNG_FILTER_NONE);  */

        /* 2.0.12: this is finally a parameter */
+       if (level < 0 || level > 9) {
+               php_gd_error("gd-png error: compression level must be between 0 
and 9");
+               return;
+       }
        png_set_compression_level(png_ptr, level);
        if (basefilter >= 0) {
                png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, basefilter);

Modified: php/php-src/trunk/ext/gd/libgd/gd_png.c
===================================================================
--- php/php-src/trunk/ext/gd/libgd/gd_png.c     2010-05-24 22:17:41 UTC (rev 
299724)
+++ php/php-src/trunk/ext/gd/libgd/gd_png.c     2010-05-24 23:27:39 UTC (rev 
299725)
@@ -515,6 +515,10 @@
        /*  png_set_filter(png_ptr, 0, PNG_FILTER_NONE);  */

        /* 2.0.12: this is finally a parameter */
+       if (level < 0 || level > 9) {
+               php_gd_error("gd-png error: compression level must be between 0 
and 9");
+               return;
+       }
        png_set_compression_level(png_ptr, level);
        if (basefilter >= 0) {
                png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, basefilter);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to