xref: /PHP-7.2/ext/gd/tests/bug73155.phpt (revision c7936ead)
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===DONE===
23--EXPECT--
24chunk size: 64
25x chunk count: 1
26y chunk count: 1
27file size: 5145
28===DONE===
29