1--TEST--
2Testing null byte injection in imagepng
3--SKIPIF--
4<?php
5if(!extension_loaded('gd')){ die('skip gd extension not available'); }
6$support = gd_info();
7if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
8	print 'skip png support not available';
9}
10?>
11--CLEAN--
12$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
13foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
14rmdir($tempdir);
15--FILE--
16<?php
17$image = imagecreate(1,1);// 1px image
18var_dump(imagepng($image, "./foo\0bar"));
19?>
20--EXPECTF--
21Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
22bool(false)
23