On 5/2/07, Arnold Daniels <[EMAIL PROTECTED]> wrote:
Hi,I've got a bug with is_link and lstats. Any symlinks not created in the current session, will not be read. This only occurs in the Apache 2 SAPI version, not in the CLI version. Script: <? $symlink = '/tmp/link-test'; if (file_exists($symlink)) unlink($symlink); symlink('/tmp/pear', $symlink); echo (file_exists($symlink) ? is_link($symlink) ? "Correct" : "ERROR" : "Couldn't create the link"), "<br/>\n"; $symlink = '/tmp/link-persist'; if (!file_exists($symlink)) symlink('/tmp/pear', $symlink); echo (file_exists($symlink) ? is_link($symlink) ? "Correct" : "ERROR" : "Couldn't create the link"), "<br/>\n"; ?> First run: Correct Correct Second run: Correct ERROR Next runs: Correct ERROR I've recently start using the daily snapshots op PHP, but I also tried it on version 5.2.1, which shows the same result. It used to work just fine, so I'm sure this isn't the expected result. I've recently upgraded from Ubuntu Edgy (6.10) to Feisty (7.04), with kernel and apache update, so I believe that the problem is related to that. I've straced the process (see attachment), but I can't pinpoint the problem. This is a big issue for me, can anyone point me in the right direction to find the source of this problem. Thanks, Arnold
<snip> Well, I've also tested this code, and it does work fine. BUT if /tmp/pear doesn't exists, what i had at first, then file_exists returns false, because file_exists follows symlinks, and the symlink pointed to nothing. So if you're sure that $symlink is a link, then it might be better to check it with is_link. Also, the is_link function is cached, so you might want to add one or more clearstatcache() in your script. I checked your strace also, but it doesn't look like there's a bug. But I've never studied on the PHP core so.... Well, if above doesn't help you, then one of the "real experts" needs to look at it :) Tijnema -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
