Still having lstat trouble
| From: | Arnold Daniels | Date: | Wed, 23 May 2007 20:37:42 +0000 |
| Subject: | Still having lstat trouble | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29700@lists.php.net to get a copy of this message | ||
Hi,
I've posted this problem some time ago, but never got a real answer and it is still bothering me a lot.
My problem is that PHP does not recognize a symlink as a symlink. It seems to be dereferenced by functions like 'lstat', 'is_link' and 'filetype'. And that isn't supposed to happen.
The bug http://bugs.php.net/bug.php?id=17128 describes my problem exactly, but is marked as bogus. Well this problem sure isn't bogus for me. I'm having this problem, since I've updated from Ubuntu Edgy to Feisty. Before that all worked fine.
Please note that I've not installed PHP from a repository, but I build the latest CVS version of PHP 5 regularly myself. Also this problem only occurs in the Apache 2 SAPI, not in the CLI version.
Let me give an example, to make the problem clear.
------------
<?
$symlink = '/tmp/link-test';
$target = '/tmp/pear';
if (!file_exists($target)) trigger_error("Target '$target' does not
exist", E_USER_ERROR);
if (file_exists($symlink) && !unlink($symlink)) trigger_error("Could
not delete '$symlink'", E_USER_ERROR);
symlink($target, $symlink);
clearstatcache();
/* This should output 'link' */
echo filetype($symlink), "\n";
/* This should output 'link' */
echo is_link($symlink) ? 'link' : 'not a link', "\n";
/* This should output 'differ' */
echo lstat($symlink) === stat($target) ? 'same' : 'differ';
?>
Expected:
link
link
differ
Actual:
dir
not a link
same
------------
I understand that if I post this as a bug, it is tested, can't be reproduced and marked as bogus. Therefore, I could appreciate it if someone could please point me towards a way to pinpoint the problem. I've run a strace already, but can't notice anything weird.
Thanks for any help,
Arnold