note 117144 added to function.realpath

From: Date: Tue, 21 Apr 2015 13:33:26 +0000
Subject: note 117144 added to function.realpath
Groups: php.notes 
Request: Send a blank email to php-notes+get-202313@lists.php.net to get a copy of this message
Beware of relative symbolic links like this one (ext4 file system on Ubuntu) : vincent@vincent:~/Bureau/dirscan$ readlink sandbox/roulant/voiture/cabriolet/ln-loop-relative ../.. In this case, realpath may return false : <?php var_dump(realpath('sandbox/roulant/voiture/cabriolet/ln-loop-relative')); // => string(44) "/home/vincent/Bureau/dirscan/sandbox/roulant" var_dump(realpath('sandbox/roulant/voiture/cabriolet/ln-loop-relative/moto')); // => bool(false) ?> But you can fix it by clearing the realpath cache, this way : <?php var_dump(realpath('sandbox/roulant/voiture/cabriolet/ln-loop-relative')); clearstatcache(true); var_dump(realpath('sandbox/roulant/voiture/cabriolet/ln-loop-relative/moto')); // => string(49) "/home/vincent/Bureau/dirscan/sandbox/roulant/moto" ?> ---- Server IP: 72.52.91.14 Probable Submitter: 178.237.101.19 ---- Manual Page -- http://php.net/manual/en/function.realpath.php Edit -- https://master.php.net/note/edit/117144 Del: integrated -- https://master.php.net/note/delete/117144/integrated Del: useless -- https://master.php.net/note/delete/117144/useless Del: bad code -- https://master.php.net/note/delete/117144/bad+code Del: spam -- https://master.php.net/note/delete/117144/spam Del: non-english -- https://master.php.net/note/delete/117144/non-english Del: in docs -- https://master.php.net/note/delete/117144/in+docs Del: other reasons-- https://master.php.net/note/delete/117144 Reject -- https://master.php.net/note/reject/117144 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202313) next »