Bug #81638 [NEW]: a set of functions about file state will not work correctly
| From: | inhann at qq dot com | Date: | Fri, 19 Nov 2021 12:37:14 +0000 |
| Subject: | Bug #81638 [NEW]: a set of functions about file state will not work correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-237868@lists.php.net to get a copy of this message | ||
From: inhann at qq dot com
Operating system: linux
PHP version: 7.4.26
Package: Streams related
Bug Type: Bug
Bug description:a set of functions about file state will not work correctly
Description:
------------
any function whose definition is started with
FileFunction(PHP_FN in
ext/standard/filestat.c will call the system call ,stat , in linux ,
which will finally return false when recieving a path with more than 20
symbolic links
the affected functions are as follows:
filepermsãfileinodeãfilesizeãfileownerãfilegroupãfileatimeãfilemtimeãfilectimeãfiletypeãis_writableãis_readableãis_executableãis_fileãis_dirãis_linkãfile_exists
........
you can read ext/standard/filestat.c to find more
Test script:
---------------
<?php
$f =
"/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/etc/passwd";
var_dump(file_exists($f));
readfile($f);
?>
file exists but file_exists($f) return false ,
is_writableãis_readableãis_executableãis_fileãis_dirãis_linkãfile_exists
...... will return false as well
Expected result:
----------------
bool(true)
the content of /etc/passwd
Actual result:
--------------
bool(false)
the content of /etc/passwd
--
Edit bug report at https://bugs.php.net/bug.php?id=81638&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81638&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81638&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81638&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81638&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81638&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81638&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81638&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81638&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81638&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81638&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81638&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81638&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81638&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81638&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81638&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81638&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81638&r=mysqlcfg