Re: I lied, another question / problem

From: Date: Sat, 20 Jan 2007 23:11:13 +0000
Subject: Re: I lied, another question / problem
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-247472@lists.php.net to get a copy of this message
Roman Neuhauser wrote: > # jochem@iamjochem.com / 2007-01-17 16:59:26 +0100: >> Roman Neuhauser wrote: >>> re_format(7) on FreeBSD: >>> >>> A bracket expression is a list of characters enclosed in `[]'. >>> (...) >>> If two characters in the list are separated by `-', this is >>> shorthand for the full range of characters between those two >>> (inclusive) in the collating sequence, e.g. `[0-9]' in ASCII >>> matches any decimal digit. >>> (...) >>> Ranges are very collating-sequence-dependent, and portable programs >>> should avoid relying on them. >> one other thing ... >> >> wouldn't it be fair to assume (safety through paranoia) that >> ctype_alnum() would suffer the same problem? (given the manual's >> indication that ctype_alnum() and the offending regexp are equivalent?) > > isalnum(3) uses isalpha(3) and isdigit(3), so yes, their results are > locale-dependent (LC_CTYPE, see setlocale(3)), but don't depend on > collating sequence. so really the doc's are slightly misleading or even incorrect, I will try to formulate a succinct question for internals@ to ask whether this should be reported as documentation bug. as a side note: do you have any real world example of where this collation issue might actually bite someone making use of the aforementioned regexp range? > isdigit(3): > > The isdigit() function tests for a decimal digit character. Regardless > of locale, this includes the following characters only: > > `0'' 1'' > 2'' > 3'' `4'' > `5'' 6'' > 7'' > 8'' `9'' >

« previous php.general (#247472) next »