Make WordPress Core

Opened 9 hours ago

Last modified 4 hours ago

#66113 new defect (bug)

Use imageflip() in WP_Image_Editor_GD::flip()

Reported by: arshidkv12 Owned by:
Priority: normal Milestone: 7.2
Component: General Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

WP_Image_Editor_GD::flip() uses negative dimensions with imagecopyresampled().

With PHP 8.6's bundled GD 2.4.0, this causes Tests_Image_Editor_GD::test_flip to fail:

Failed asserting that 0 is identical to 8434407

The same operation works with PHP 8.5/GD 2.3.3. imageflip() produces the expected result on both versions.

This patch replaces the imagecopyresampled() implementation with imageflip() while preserving the existing flip behavior.

Change History (2)

This ticket was mentioned in PR #13549 on WordPress/wordpress-develop by @arshidkv12.


9 hours ago
#1

  • Keywords has-patch added

Use imageflip() in WP_Image_Editor_GD::flip() instead of imagecopyresampled() with negative dimensions.

This fixes image flipping with PHP 8.6 / GD 2.4.0, where the existing implementation can produce incorrect pixel data.

[Trac ticket: https://core.trac.wordpress.org/ticket/66113
](https://core.trac.wordpress.org/ticket/66113)

Use of AI Tools

AI assistance: Yes
Tool(s): ChatGPT
Model(s): GPT-5.6 Luna
Used for: Debugging and test suggestions;

#2 @SergeyBiryukov
4 hours ago

  • Milestone Awaiting Review7.2
Note: See TracTickets for help on using tickets.