Hi, On Friday 24 October 2003 20:45, Ilia Alshanetsky wrote:
> > Check for mktime with out-of-range parameters > > [ext/standard/tests/time/003.phpt] > > mktime() [ext/standard/tests/time/mktime.phpt] > > Also, a MacOSX specific issue that is not PHP5 specific. Actually - a BSD mktime specific issue and again an issue of differences in the values set for the TZ variable. I've experimented a little with TZ values and used AIX as a reference for an implementation that doesn't understand Country/City implementations. When Europe/Amsterdam is set as TZ on AIX, date('O') reports +0000 as offset - ie: it defaults to GMT. However - if CET-1CEST is used for BSD, it reports +0200 as offset - in fact it will report +0200 for any -1 value, even if the timezones surrounding are completely bogus. Using that approach we can fix the test as attached. The same applies to 002.phpt and changing detection of 'T' to 'O' makes it work for AIX as well. The only insolvable problem is with tests/time/mktime.phpt, because: * As far as BSD time is concerned: if a zone does not support DST, it will return 0 for any attempts to do so. GMT as a zone does not support DST. * If Europe/London is selected for the timezone and dst is forced, then it will indeed force it, where others don't. Patch applies to both php5 as php4. Does this work on linux correctly? -- Melvyn
Index: ext/standard/tests/time/002.phpt =================================================================== RCS file: /repository/php-src/ext/standard/tests/time/002.phpt,v retrieving revision 1.4.2.5 diff -u -r1.4.2.5 002.phpt --- ext/standard/tests/time/002.phpt 9 Sep 2003 21:31:51 -0000 1.4.2.5 +++ ext/standard/tests/time/002.phpt 26 Oct 2003 09:09:30 -0000 @@ -34,7 +34,7 @@ } putenv("TZ=US/Eastern"); - if( date("T") == "GMT" ) { + if( date("O") == "+0000" ) { // POSIX style putenv ("TZ=EST5EDT4,M4.1.0,M10.5.0"); } Index: ext/standard/tests/time/003.phpt =================================================================== RCS file: /repository/php-src/ext/standard/tests/time/003.phpt,v retrieving revision 1.1.4.1 diff -u -r1.1.4.1 003.phpt --- ext/standard/tests/time/003.phpt 9 Feb 2003 12:05:58 -0000 1.1.4.1 +++ ext/standard/tests/time/003.phpt 26 Oct 2003 09:09:30 -0000 @@ -15,7 +15,11 @@ echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2001)) ."\n"; echo date("Y-m-d", mktime( 12, 0, 0, 0, 0, 2000)) ."\n"; - putenv("TZ=GST-1GDT"); + putenv("Europe/Amsterdam"); + if( date('O') == '+0000' ) + { + puntenv("TZ=GST-1GDT"); + } echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,-1))."\n"; echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,0))."\n"; echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,1))."\n";
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php