Re: [patch] expose PHP version details as constants

From: Date: Tue, 12 Feb 2008 12:01:48 +0000
Subject: Re: [patch] expose PHP version details as constants
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-35411@lists.php.net to get a copy of this message
Pierre Joye schreef:
Hi Jochen, On Feb 12, 2008 12:22 PM, Jochem Maas <jochem@iamjochem.com> wrote:
Sebastian Bergmann schreef:
Jochem Maas schrieb:
Output: C:\ Is this intended?
Yes, or what would you expect?
possibly 'C:' ?
Is "C:" not the volume whereas "C:\" is the root directory on the volume?
this is what I thought, kind of, but I was just proposing what the OP was expecting.
the OP?
it does make one think a little about the small discrepancy with regard to whether the slash is 'appended' or not depending on whether the dir is the root or not: php -r ' echo dirname("/Users"),"\n", dirname("/Users/foo"),"\n"; ' / /Users
You ask the directory name of a path. In the first case, you ask the directory name of the path /Users (or /Users/), it is "/". The directory name of the path "/Users/foo" is "/Users". Everything works as expected as far as I can see.
I agree, I was merely pondering out loud, no problems as such.
which means one cannot blindly say: include __DIR__."/somefile";
Little notice: OSes without volumes will work smoothly. For those with volumes (windows, novell afair) willl use the current volume.
although that's probably moot because my experience is that extraneous slashes in a path are, afaik, always ignored. i.e. /foo//foo//foo == /foo/foo/foo, so really there is nothing to see here.
Yes, PHP is very tolerant (and brought us some headaches too in the pasts :). It is also tolerant with \ or / usages.
I can imagine it has caused headaches for dev's working with the underlying implementation .. I for one am grateful it's so tolerant ... more than once have I noticed some badly defined paths working without a problem, months after the code was originally written. 3 cheers for tolerance :-)
Cheers,


« previous php.internals (#35411) next »