xref: /PHP-8.4/tests/security/bug53226.phpt (revision 53544e36)
1--TEST--
2Bug #53226 (file_exists fails on big filenames)
3--INI--
4open_basedir=.
5--FILE--
6<?php
7require_once "open_basedir.inc";
8create_directories();
9
10var_dump(file_exists('./test/ok/ok.txt'));
11var_dump(file_exists('./test/foo'));
12
13$file = str_repeat('x', 2 * PHP_MAXPATHLEN);
14var_dump(file_exists("./test/$file"));
15?>
16--CLEAN--
17<?php
18require_once "open_basedir.inc";
19delete_directories();
20?>
21--EXPECTF--
22bool(true)
23bool(true)
24bool(true)
25bool(true)
26bool(false)
27
28Warning: file_exists(): File name is longer than the maximum allowed path length on this platform (%d): %s in %s on line %d
29bool(false)
30