Re: Test results
| From: | Melvyn Sopacua | Date: | Tue, 29 Oct 2002 17:42:35 +0000 |
| Subject: | Re: Test results | ||
| References: | 1 2 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-6472@lists.php.net to get a copy of this message | ||
At 22:55 10/29/2002 +0900, Moriyoshi Koizumi wrote:
--snip
When I added the FreeBSD locale yesterday, I made a typo (before commit).
The skipif section was correct, but I typed ISO88x9 or sumfin, in the
test itself.
Therefore setlocale failed in the test - not the skipif section and I
got the output as below.
That's why I recognized it. If the skipif and testcode are the same,
I have no plausible explanation, other than you can't setlocale() twice? :)
I heard (but I'm not sure) that some version of glibc has a bug
in locale handling. I suspect that setlocale() of that version
never returns a null value even if the specified locale name
is invalid. In this case, SKIPIF section should be updated
like below:
--SKIPIF--
<?php
setlocale(LC_CTYPE,'fr_FR.ISO8859-15@euro');
if (setlocale(LC_CTYPE,0) != 'fr_FR.ISO8859-1') {
die("skip setlocale failed.");
}
?>
We don't do comparison anymore, because it's too platform dependant. That's
why Ilya implemented an arbitrary number of arguments, to allow x-platform
developers to add as many locales as they know about.
The patch below, should do what you are looking to do.
Now if somebody could test that on Redhat 7.1/gcc 2.96, it would be splendid.
BTW: this patch is not meant as a serious contribution as it's a work-around for
a bug not in PHP. setlocale() should return NULL (not "" or whatever) when it fails,
so the current implementation is correct. It's just provided to determine the
reason for this test failure.
And if the test still fails, I can't give it a reasonable explanation any more :)Let's hope it's an oddity then :) Index: string.c =================================================================== RCS file: /repository/php4/ext/standard/string.c,v retrieving revision 1.329 diff -u -r1.329 string.c
--- string.c 25 Oct 2002 20:09:53 -0000 1.329 +++ string.c 29 Oct 2002 17:29:33 -0000@@ -3224,8 +3224,14 @@
setlocale(LC_NUMERIC, "C");
}
}
-
- return;
+ if (strcmp(retval, loc) == 0) {
+ return;
+ } else {
+ if (i + 1 >= n_args) {
+ efree(args);
+ RETURN_FALSE;
+ }
+ }
}
if (Z_TYPE_PP(args[1]) == IS_ARRAY) {
Met vriendelijke groeten / With kind regards,
Webmaster IDG.nl
Melvyn Sopacua
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"