xref: /PHP-8.3/ext/gd/tests/bug77272.phpt (revision 0aaad46c)
1--TEST--
2Bug #77272 (imagescale() may return image resource on failure)
3--INI--
4memory_limit=-1
5--EXTENSIONS--
6gd
7--SKIPIF--
8<?php
9if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream fix not yet released');
10if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
11if (substr(PHP_OS, 0, 3) == 'WIN' && PHP_INT_SIZE === 4) die("skip not for Windows x86");
12?>
13--FILE--
14<?php
15$img = imagecreate(2**28, 1);
16var_dump(imagescale($img, 1, 1, IMG_TRIANGLE));
17?>
18--EXPECTF--
19Warning: imagescale():%S %croduct of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
20 in %s on line %d
21bool(false)
22