#50366 [Opn->Fbk]: realpath() doesn't correctly resolve symlink

From: Date: Thu, 03 Dec 2009 08:13:47 +0000
Subject: #50366 [Opn->Fbk]: realpath() doesn't correctly resolve symlink
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145359@lists.php.net to get a copy of this message
ID: 50366 Updated by: jani@php.net Reported By: jerico dot dev at gmail dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Linux PHP Version: 5.2.11 New Comment: "realpath() expands all symbolic links and resolves references to '/./', '/../' and extra '/' characters in the input path . and return the canonicalized absolute pathname. " And since it first resolves to /home/user/test/something/tests from where you go down 3 levels, of course you get /home/user/ ? See this: # php -r 'echo realpath("/home/jani/test/app/lib/symlink/tests/"), "\n";' /home/jani/test/something/tests # php -r 'echo realpath("/home/jani/test/app/lib/symlink/tests/../../.."), "\n";' /home/jani Previous Comments: ------------------------------------------------------------------------ [2009-12-03 05:42:33] jerico dot dev at gmail dot com Reproduced with php5.2-200912022330 compiled on Ubuntu Jaunty ------------------------------------------------------------------------ [2009-12-02 22:40:51] jani@php.net Please try using this snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2009-12-02 22:07:41] jerico dot dev at gmail dot com Description: ------------ realpath() doesn't resolve symlinks correctly when followed by /.. Reproduce code: --------------- echo realpath('/home/user/test/app/lib/symlink/tests/../../..'); where "symlink" points to /home/user/test/something Expected result: ---------------- /home/user/test/app Actual result: -------------- /home/user ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50366&edit=1

« previous php.bugs (#145359) next »