xref: /PHP-7.4/ext/standard/tests/file/bug39863.phpt (revision d679f022)
1--TEST--
2Bug #39863 (file_exists() silently truncates after a null byte)
3--CREDITS--
4Andrew van der Stock, vanderaj @ owasp.org
5--FILE--
6<?php
7
8$filename = __FILE__ . chr(0). ".ridiculous";
9
10if (file_exists($filename)) {
11    echo "FAIL\n";
12}
13else {
14    echo "PASS\n";
15}
16?>
17===DONE===
18<?php exit(0); ?>
19--EXPECTF--
20Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d
21PASS
22===DONE===
23