realpath vs pathinfo

In the index.php you can find
if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
    $system_folder = str_replace("\\", "/", realpath(dirname(__FILE__))).'/'.$system_folder;
why not use
$system_folder = str_replace('\', '/',pathinfo(__FILE__,PATHINFO_DIRNAME)).'/'.$system_folder;
Is the pathinfo less trustworthy than realpath?

[eluser]Michael Wales[/eluser]
pathinfo() doesn't actually verify anything with the file system, it just merely analyzes the string that is passed to it.


    [dirname] => /no/where
    [basename] => file.txt
    [extension] => txt
    [filename] => file

i think i found out why realpath is used
Quote:Since PHP 4.0.2, __FILE__ always contains an absolute path whereas in older versions it contained relative path under some circumstances.

[eluser]Chris Newton[/eluser]
From the PHP manual: Realpath expands all symbolic links and resolves references to '/./', '/../' and extra '/' characters in the input path . and return the canonicalized absolute pathname.

As far as I know, pathinfo does not do that.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.