Bug #72625 [NEW]: realpath() fails on very long argument.

From: Date: Wed, 20 Jul 2016 03:53:16 +0000
Subject: Bug #72625 [NEW]: realpath() fails on very long argument.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202431@lists.php.net to get a copy of this message
From: anrdaemon at freemail dot ru Operating system: Windows PHP version: 7.0.8 Package: Filesystem function related Bug Type: Bug Bug description:realpath() fails on very long argument. Description: ------------ When given a long string (> 260 characters), realpath() and SplFileInfo::getRealPath() both fail to convert path to something sensible and return empty result. However, using dirname() to shorten the input string will result in the function working again. Additionally, PHP reporting "invalid path", if you try to use extended access syntax ('\\?\<path>'). (Oh, and before you say something silly, the sting in example is an equivalent of a real path generated by Composer.) Test script: --------------- <?php $fn = "{$_SERVER['TEMP']}/_test/documents/projects/myproject/vendor/name/library/classpath"; $fn1 = "$fn/../../../../../../../../_test/documents/projects/myproject/vendor/name/library/../../../../../../../_test/documents/projects/myproject/vendor/name/library/classpath"; mkdir($fn, 0777, true); error_log(strlen($fn)); error_log(realpath($fn)); error_log(strlen($fn1)); error_log($fn1); error_log(realpath($fn1)); error_log(strlen(dirname($fn1))); error_log(dirname($fn1)); error_log(realpath(dirname($fn1))); -- Edit bug report at https://bugs.php.net/bug.php?id=72625&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72625&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72625&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72625&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72625&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72625&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72625&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72625&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72625&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72625&r=support Expected behavior: https://bugs.php.net/fix.php?id=72625&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72625&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72625&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72625&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72625&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72625&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72625&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72625&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72625&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72625&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72625&r=mysqlcfg

« previous php.bugs (#202431) next »