]> granicus.if.org Git - php/commitdiff
fnmatch error when pattern or filename too long
authorPete Albrecht <palbrecht@i3logix.com>
Tue, 3 Oct 2017 21:39:22 +0000 (15:39 -0600)
committerPeter Kokot <peterkokot@gmail.com>
Sun, 10 Feb 2019 18:38:46 +0000 (19:38 +0100)
i3logix PHP Testfest 2017

ext/standard/tests/file/fnmatch_maxpathlen.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/file/fnmatch_maxpathlen.phpt b/ext/standard/tests/file/fnmatch_maxpathlen.phpt
new file mode 100644 (file)
index 0000000..849e771
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Test fnmatch() function : warning filename or pattern exceeds maxpathlen
+--SKIPIF--
+<?php
+if (!function_exists('fnmatch')) die('skip fnmatch() function is not available');
+?>
+--FILE--
+<?php
+$longstring = str_pad('blah', PHP_MAXPATHLEN);
+var_dump(fnmatch('blah', $longstring));
+var_dump(fnmatch($longstring, 'blah'));
+?>
+--EXPECTF--
+Warning: fnmatch(): Filename exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
+
+Warning: fnmatch(): Pattern exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)