xref: /PHP-8.0/ext/gd/tests/bug73155.phpt (revision a555cc0b)
1--TEST--
2Bug #73155 (imagegd2() writes wrong chunk sizes on boundaries)
3--SKIPIF--
4<?php
5if (!extension_loaded('gd')) die('skip gd extension not available');
6?>
7--FILE--
8<?php
9$im = imagecreate(64, 64);
10imagecolorallocate($im, 0, 0, 0);
11
12ob_start();
13imagegd2($im, null, 64, IMG_GD2_RAW);
14$buffer = ob_get_clean();
15
16$header = unpack('@10/nchunk_size/nformat/nx_count/ny_count', $buffer);
17printf("chunk size: %d\n", $header['chunk_size']);
18printf("x chunk count: %d\n", $header['x_count']);
19printf("y chunk count: %d\n", $header['y_count']);
20printf("file size: %d\n", strlen($buffer));
21?>
22--EXPECT--
23chunk size: 64
24x chunk count: 1
25y chunk count: 1
26file size: 5145
27