note 75217 added to function.realpath
| From: | Sebastian at osu1 dot php dot net | Date: | Fri, 18 May 2007 12:00:00 +0000 |
| Subject: | note 75217 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126685@lists.php.net to get a copy of this message | ||
Who ever wrote the rp()-function. First of all, your function skips filenames or directories with
"0" because you use == instead of === when comparing to an "empty" value.
Second, the idea of realpath() isn't fixing useless "../" etc, but to resolve the
full path of a relative directory/file or a symbolic link. So that if you run the script in
'/usr/local/apache2/htdocs/' and exec realpath('uploads/test.txt') the output
becomes '/usr/local/apache2/htdocs/uploads/test.txt' (as in the example)
I also wonder why the implementations aren't using the DIRECTORY_SEPARATOR constant and expect
Unix.
----
Server IP: 80.81.171.181
Probable Submitter: 62.142.250.245
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/75217
Del: integrated -- https://master.php.net/note/delete/75217/integrated
Del: useless -- https://master.php.net/note/delete/75217/useless
Del: bad code -- https://master.php.net/note/delete/75217/bad+code
Del: spam -- https://master.php.net/note/delete/75217/spam
Del: non-english -- https://master.php.net/note/delete/75217/non-english
Del: in docs -- https://master.php.net/note/delete/75217/in+docs
Del: other reasons-- https://master.php.net/note/delete/75217
Reject -- https://master.php.net/note/reject/75217
Search -- https://master.php.net/manage/user-notes.php