Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29138 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49485 invoked by uid 1010); 3 May 2007 09:28:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49470 invoked from network); 3 May 2007 09:28:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2007 09:28:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=tijnema@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tijnema@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.132.242 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tijnema@gmail.com X-Host-Fingerprint: 209.85.132.242 an-out-0708.google.com Received: from [209.85.132.242] ([209.85.132.242:40281] helo=an-out-0708.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/18-08359-F2BA9364 for ; Thu, 03 May 2007 05:28:16 -0400 Received: by an-out-0708.google.com with SMTP id c28so447883ana for ; Thu, 03 May 2007 02:28:12 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dISuWIUXrDnnv2xL+P7/DjZBY0oRhrnOkCFwPqrOg2X5AGh6HPMpHor1BQv7EqQ5dojeMBedG3zw0Fj3x97/3mfejIPu2akGZcq+SaumSy5gaowAZcNvLYmEsdoJuI76O7r0j0tz4h6iDKJEHdV9po7iYQhuVx7nB6cOkkCOnD4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HoinHyQF+x94QjO4fGJG4BXSnGOD0OvCcTGI+YrGCiXBY8NMoE/ccveLd0+wXnODfAOJj5jfBY5oy1M5sX7O0Fz3XI7egrFXRXCECfHPXbe/rUhbYT19dzDkkIOVIQiJ6ObQTw7K02Ya6ufBxlewA19tq65BPxU5SWbDmehonoc= Received: by 10.100.59.20 with SMTP id h20mr1355896ana.1178184492710; Thu, 03 May 2007 02:28:12 -0700 (PDT) Received: by 10.100.43.17 with HTTP; Thu, 3 May 2007 02:28:12 -0700 (PDT) Message-ID: Date: Thu, 3 May 2007 11:28:12 +0200 To: "Arnold Daniels" Cc: internals@lists.php.net In-Reply-To: <4638E608.2090202@adaniels.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4638E608.2090202@adaniels.nl> Subject: Re: [PHP-DEV] How to find a bug: is_link troubles From: tijnema@gmail.com ("Tijnema !") On 5/2/07, Arnold Daniels 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"), "
\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"), "
\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 > 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