If you run this script when $sym_dir is a symbolic link to a directory:
echo getcwd()."\n";
chdir ($sym_dir);
chdir ('../');
echo getcwd()."\n";
It returns for example:
/dades/loc/real/mapes/navteq/anloc
/mapes/anloc
It will not return to the previous directory, it returns to the parent of the real directory where it links the symbolic link.
It's not necessary a bug but I think it's important to have present this.
It could be solved saving the current directory and then returning to it. For example:
$cwd = getcwd();
echo getcwd()."\n";
chdir ($sym_dir);
chdir ($cwd);
echo getcwd()."\n";
It returns:
/dades/loc/real/mapes/navteq/anloc
/dades/loc/real/mapes/navteq/anloc
Have fun :)
-------
Josep Rubio (Anloc S.L. www.anloc.net)