php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60160 imagefill() doesn't work correctly for small images
Submitted: 2011-10-28 17:30 UTC Modified: 2011-11-01 12:11 UTC
From: kieran at menor dot dk Assigned: fa (profile)
Status: Closed Package: GD related
PHP Version: 5.3.8 OS: Windows 7 x64, Debian 6 x64
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kieran at menor dot dk
New email:
PHP Version: OS:

 

 [2011-10-28 17:30 UTC] kieran at menor dot dk
Description:
------------
imagefill() doesn't work correctly for images with a width lower than 4 pixels. Image height makes no difference.

Test script:
---------------
<?php
header('Content-Type: image/png');
$im = imagecreatetruecolor(3, 3);
imagefill($im, 0, 0, imagecolorallocate($im, 255, 255, 255));
imagepng($im);
imagedestroy($im);

Expected result:
----------------
Completely white 3x3 pixels image expected.

Actual result:
--------------
Upper and left edge white, 2x2 black square in lower right corner.

http://caffie.net/broken.php

Patches

bug60160.phpt (last revision 2011-10-31 15:26 UTC by fa@php.net)
fix-imagefill-for-images-smaller-than-4px-width (last revision 2011-10-31 14:51 UTC by fa@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-28 17:39 UTC] kieran at menor dot dk
Workaround:
------------
Use imagefilledrectangle() instead, alike so:

function imagefillfix($image, $x, $y, $color)
{
	return imagefilledrectangle($image, $x, $y, imagesx($image) - 1, imagesy($image) - 1, $color);
}
 [2011-10-31 14:51 UTC] fa@php.net
The following patch has been added/updated:

Patch Name: fix-imagefill-for-images-smaller-than-4px-width
Revision:   1320072664
URL:        https://bugs.php.net/patch-display.php?bug=60160&patch=fix-imagefill-for-images-smaller-than-4px-width&revision=1320072664
 [2011-10-31 15:19 UTC] fa@php.net
-Status: Open +Status: Analyzed
 [2011-10-31 15:19 UTC] fa@php.net
Related to https://bugs.php.net/51671 - that didn't get fixed completely, as can be seen in the test for #51671.
 [2011-10-31 15:26 UTC] fa@php.net
The following patch has been added/updated:

Patch Name: bug60160.phpt
Revision:   1320074804
URL:        https://bugs.php.net/patch-display.php?bug=60160&patch=bug60160.phpt&revision=1320074804
 [2011-11-01 11:51 UTC] fa@php.net
Automatic comment from SVN on behalf of fa
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=318638
Log: Fixed #60160 and added a test for it
 [2011-11-01 12:11 UTC] fa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2011-11-01 12:11 UTC] fa@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: fa
 [2012-04-18 09:48 UTC] laruence@php.net
Automatic comment on behalf of fa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=be930868aacdd12b8487457c62dd48dfcb00defb
Log: Fixed #60160 and added a test for it
 [2012-07-24 23:39 UTC] rasmus@php.net
Automatic comment on behalf of fa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=be930868aacdd12b8487457c62dd48dfcb00defb
Log: Fixed #60160 and added a test for it
 [2013-11-17 09:35 UTC] laruence@php.net
Automatic comment on behalf of fa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=be930868aacdd12b8487457c62dd48dfcb00defb
Log: Fixed #60160 and added a test for it
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC