1--TEST--
2Testing null byte injection in imagejpeg
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7$support = gd_info();
8if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
9    print 'skip jpeg support not available';
10}
11?>
12--FILE--
13<?php
14$image = imagecreate(1,1);// 1px image
15try {
16    imagejpeg($image, "./foo\0bar");
17} catch (TypeError $e) {
18    echo $e->getMessage(), "\n";
19}
20?>
21--EXPECT--
22imagejpeg(): Argument #2 ($file) must not contain null bytes
23