xref: /PHP-8.2/ext/standard/tests/image/bug70096.phpt (revision 74859783)
1--TEST--
2Bug #70096 (Repeated iptcembed() adds superfluous FF bytes)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!function_exists('imagejpeg')) die('skip imagejpeg not available');
8?>
9--FILE--
10<?php
11$filename = __DIR__ . '/bug70096.jpg';
12$im = imagecreatetruecolor(10, 10);
13imagejpeg($im, $filename);
14imagedestroy($im);
15$data = "\x1C\x02x\x00\x0ATest image"
16    . "\x1C\x02t\x00\x22Copyright 2008-2009, The PHP Group";
17$content1 = iptcembed($data, $filename);
18$fp = fopen($filename, "wb");
19fwrite($fp, $content1);
20fclose($fp);
21$content2 = iptcembed($data, $filename);
22$fp = fopen($filename, "wb");
23fwrite($fp, $content2);
24fclose($fp);
25var_dump($content1 === $content2);
26?>
27--CLEAN--
28<?php
29$filename = __DIR__ . '/bug70096.jpg';
30@unlink($filename);
31?>
32--EXPECT--
33bool(true)
34