xref: /php-src/ext/gd/tests/bug79945.phpt (revision 0b8466f2)
1--TEST--
2Bug #79945 (using php wrappers in imagecreatefrompng causes segmentation fault)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!(imagetypes() & IMG_PNG)) {
8    die("skip No PNG support");
9}
10set_error_handler(function($errno, $errstr) {
11    if (str_contains($errstr, 'Cannot cast a filtered stream on this system')) {
12        die('skip: fopencookie not support on this system');
13    }
14});
15imagecreatefrompng('php://filter/read=convert.base64-encode/resource=' . __DIR__ . '/test.png');
16restore_error_handler();
17?>
18--FILE--
19<?php
20imagecreatefrompng('php://filter/read=convert.base64-encode/resource=' . __DIR__ . '/test.png');
21?>
22--CLEAN--
23--EXPECTF--
24
25Warning: imagecreatefrompng(): "php://filter/read=convert.base64-encode/resource=%s" is not a valid PNG file in %s on line %d
26