Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(core): report 0 loops for a still image - #126

Merged
olivervogel merged 1 commit into
Intervention:developfrom
nlemoine:fix/core-loops
Sep 9, 2026
Merged

fix(core): report 0 loops for a still image#126
olivervogel merged 1 commit into
Intervention:developfrom
nlemoine:fix/core-loops

Conversation

@nlemoine

@nlemoine nlemoine commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

$image->loops() on a still image throws with the vips driver:

$manager = new ImageManager(new Driver());
$manager->decodePath('photo.jpg')->loops(); // DriverException, vips_image_get: field "loop" not found
$manager->createImage(10, 10)->loops();     // same

GD returns 0 (its default), Imagick returns getImageIterations(), 0 for a still image. The vips Core::loops() read the loop field unguarded. It now checks the field first and returns 0 when it is missing, like count() does for n-pages.

loops() read the loop field unguarded and threw a DriverException on
any image without one, that is every still image, decoded or created.
GD and Imagick report 0 there. Guard the read like count() does for
n-pages.
@olivervogel

Copy link
Copy Markdown
Member

Thanks.

@olivervogel
olivervogel merged commit f2799f6 into Intervention:develop Sep 9, 2026
6 checks passed
olivervogel pushed a commit that referenced this pull request Sep 9, 2026
loops() read the loop field unguarded and threw a DriverException on
any image without one, that is every still image, decoded or created.
GD and Imagick report 0 there. Guard the read like count() does for
n-pages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants