Skip to content

Commit

Permalink
Media: fix potential error in class-avif-info.php::get_item_features().
Browse files Browse the repository at this point in the history
Import upstream fix from libavifinfo, correcting a potential fatal error.

Props yguyon.
Fixes #60980.



git-svn-id: https://develop.svn.wordpress.org/trunk@58049 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
adamsilverstein committed Apr 26, 2024
1 parent 7de15eb commit 2074392
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/class-avif-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private function get_item_features( $target_item_id, $tile_depth ) {
if ( $tile->parent_item_id != $target_item_id ) {
continue;
}
$status = get_item_features( $tile->tile_item_id, $tile_depth + 1 );
$status = $this->get_item_features( $tile->tile_item_id, $tile_depth + 1 );
if ( $status != NOT_FOUND ) {
return $status;
}
Expand Down
Binary file added tests/phpunit/data/images/avif-alpha-grid2x1.avif
Binary file not shown.
11 changes: 11 additions & 0 deletions tests/phpunit/tests/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,17 @@ public function data_wp_getimagesize() {
'mime' => 'image/avif',
),
),
// Grid AVIF.
array(
DIR_TESTDATA . '/images/avif-alpha-grid2x1.avif',
array(
199,
200,
IMAGETYPE_AVIF,
'width="199" height="200"',
'mime' => 'image/avif',
),
),
);

return $data;
Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/tests/image/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,15 @@ public function data_wp_get_avif_info() {
'num_channels' => 4,
),
),
array(
DIR_TESTDATA . '/images/avif-alpha-grid2x1.avif',
array(
'width' => 199,
'height' => 200,
'bit_depth' => 8,
'num_channels' => 4,
),
),
array(
DIR_TESTDATA . '/images/colors_hdr_p3.avif',
array(
Expand Down

0 comments on commit 2074392

Please sign in to comment.