xref: /PHP-8.4/ext/gd/tests/bug73155.phpt (revision 0aaad46c)
1--TEST--
2Bug #73155 (imagegd2() writes wrong chunk sizes on boundaries)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7    if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
8        die("skip test requires GD 2.3.2 or older");
9    }
10?>
11--FILE--
12<?php
13$im = imagecreate(64, 64);
14imagecolorallocate($im, 0, 0, 0);
15
16ob_start();
17imagegd2($im, null, 64, IMG_GD2_RAW);
18$buffer = ob_get_clean();
19
20$header = unpack('@10/nchunk_size/nformat/nx_count/ny_count', $buffer);
21printf("chunk size: %d\n", $header['chunk_size']);
22printf("x chunk count: %d\n", $header['x_count']);
23printf("y chunk count: %d\n", $header['y_count']);
24printf("file size: %d\n", strlen($buffer));
25?>
26--EXPECT--
27chunk size: 64
28x chunk count: 1
29y chunk count: 1
30file size: 5145
31