Re: How to find a bug: is_link troubles
| From: | Tijnema ! | Date: | Thu, 03 May 2007 09:28:12 +0000 |
| Subject: | Re: How to find a bug: is_link troubles | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29138@lists.php.net to get a copy of this message | ||
On 5/2/07, Arnold Daniels <info@adaniels.nl> 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: <?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$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 CorrectSecond run:Correct ERRORNext runs:Correct ERRORI'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>