summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2010-04-28 08:23:44 +0000
committerPierre Joye <pajoye@php.net>2010-04-28 08:23:44 +0000
commitc09a8cb043604996b29965f2c98fbda6d91387a3 (patch)
treebcb1c2744d67b1c13910b1862fb0bc82d18f1e5f
parent27d922c49fe6d1d9b1e90f2022b87caff8889afd (diff)
downloadphp-git-c09a8cb043604996b29965f2c98fbda6d91387a3.tar.gz
- Fix #51671, imagefill does not work correctly for small images
-rw-r--r--ext/gd/libgd/gd.c2
-rw-r--r--ext/gd/tests/bug51671.phpt24
2 files changed, 25 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index b9cde26296..0510bec14e 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -1907,7 +1907,7 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
goto done;
}
gdImageSetPixel(im, ix, iy, nc);
- } while(ix++ < (im->sx -1));
+ } while(iy++ < (im->sy -1));
goto done;
}
diff --git a/ext/gd/tests/bug51671.phpt b/ext/gd/tests/bug51671.phpt
new file mode 100644
index 0000000000..5dd77fe67b
--- /dev/null
+++ b/ext/gd/tests/bug51671.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #51671 (imagefill does not work correctly for small images)
+--SKIPIF--
+<?php
+ if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+?>
+--FILE--
+<?php
+$w = 1;
+$h = 50;
+$im = imagecreatetruecolor($w, $h);
+$white = imagecolorallocate($im, 255, 255, 255);
+imagefill($im, 0, 0, $white);
+
+for ($iy = 0; $iy < $h; $iy++) {
+ if (($c = imagecolorat($im, 0, $iy)) != $white) {
+ printf("Failed, (0, $iy) is %X\n", $c);
+ }
+}
+
+echo "OK\n";
+?>
+--EXPECTF--
+OK