Bug #77200 [NEW]: imagecropauto(…, GD_CROP_SIDES) crops left but not right

From: Date: Sun, 25 Nov 2018 17:02:56 +0000
Subject: Bug #77200 [NEW]: imagecropauto(…, GD_CROP_SIDES) crops left but not right
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218129@lists.php.net to get a copy of this message
From: cmb Operating system: * PHP version: 7.2Git-2018-11-25 (Git) Package: GD related Bug Type: Bug Bug description:imagecropauto(…, GD_CROP_SIDES) crops left but not right Description: ------------ Forwarding from upstream[1], since our bundled libgd is affected as well. The test script creates an image with four unicolored quadrants. If the same color is used for the top left and bottom left quadrants, imagecropauto(…, GD_CROP_SIDES) works as expected. If the same color is used for the top right and bottom right quadrants, imagecropauto(…, GD_CROP_SIDES) fails to crop, though. [1] <https://github.com/libgd/libgd/issues/486> Test script: --------------- <?php $orig = imagecreatetruecolor(8, 8); $red = imagecolorallocate($orig, 255, 0, 0); $green = imagecolorallocate($orig, 0, 255, 0); $blue = imagecolorallocate($orig, 0, 0, 255); imagefilledrectangle($orig, 0, 0, 3, 3, $green); // tl imagefilledrectangle($orig, 4, 0, 7, 3, $red); // tr imagefilledrectangle($orig, 0, 4, 3, 7, $green); // bl imagefilledrectangle($orig, 4, 4, 7, 7, $blue); // br $cropped = imagecropauto($orig, IMG_CROP_SIDES); var_dump(imagesx($cropped)); imagefilledrectangle($orig, 0, 0, 3, 3, $red); // tl imagefilledrectangle($orig, 4, 0, 7, 3, $green); // tr imagefilledrectangle($orig, 0, 4, 3, 7, $blue); // bl imagefilledrectangle($orig, 4, 4, 7, 7, $green); // br $cropped = imagecropauto($orig, IMG_CROP_SIDES); var_dump(imagesx($cropped)); Expected result: ---------------- int(4) int(4) Actual result: -------------- int(4) int(8) -- Edit bug report at https://bugs.php.net/bug.php?id=77200&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77200&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77200&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77200&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77200&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77200&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77200&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77200&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77200&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77200&r=support Expected behavior: https://bugs.php.net/fix.php?id=77200&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77200&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77200&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77200&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77200&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77200&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77200&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77200&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77200&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77200&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77200&r=mysqlcfg

« previous php.bugs (#218129) next »