1--TEST--
2imageloadfont() "End of file while reading header"
3--CREDITS--
4Ike Devolder <ike.devolder@gmail.com>
5User Group: PHP-WVL & PHPGent #PHPTestFest
6--EXTENSIONS--
7gd
8--FILE--
9<?php
10$filename = __DIR__ .  '/imageloadfont_end_of_file_while_reading_header.gdf';
11
12// End of file while reading header
13$bin = "\x41\x41\x41\x41\x00\x00\x00\x00\x00\x00";
14$fp = fopen($filename, 'wb');
15fwrite($fp, $bin);
16fclose($fp);
17$font = imageloadfont($filename);
18
19// Error while reading header
20$bin = "\xe0\x00\x00\x00\x20\x00\x00\x00\x06\x00\x00\x00\x0a\x00\x00";
21$fp = fopen($filename, 'wb');
22fwrite($fp, $bin);
23fclose($fp);
24$font = imageloadfont($filename);
25?>
26--CLEAN--
27<?php
28unlink(__DIR__.'/imageloadfont_end_of_file_while_reading_header.gdf');
29?>
30--EXPECTF--
31Warning: imageloadfont(): End of file while reading header in %s on line %d
32
33Warning: imageloadfont(): End of file while reading header in %s on line %d
34