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