Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10755 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52575 invoked by uid 1010); 24 Jun 2004 12:13:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 52551 invoked from network); 24 Jun 2004 12:13:35 -0000 Received: from unknown (HELO xaxa.search.ch) (195.141.85.117) by pb1.pair.com with SMTP; 24 Jun 2004 12:13:35 -0000 Received: from localhost (localhost [127.0.0.1]) by xaxa.search.ch (Postfix) with ESMTP id 9A7086CF8E; Thu, 24 Jun 2004 14:13:34 +0200 (CEST) Received: by xaxa.search.ch (Postfix, from userid 65534) id 73D966D851; Thu, 24 Jun 2004 14:13:33 +0200 (CEST) Received: from cschneid.com (ultrafilter-i [192.168.85.2]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by xaxa.search.ch (Postfix) with ESMTP id C6C736CF8E; Thu, 24 Jun 2004 14:13:32 +0200 (CEST) Message-ID: <40DAC56C.2030101@cschneid.com> Date: Thu, 24 Jun 2004 14:13:32 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040114 X-Accept-Language: en-us, en, de-ch MIME-Version: 1.0 To: Nuno Lopes Cc: PHPdev References: <001d01c459d4$4fbc5d20$0100a8c0@pc07653> In-Reply-To: <001d01c459d4$4fbc5d20$0100a8c0@pc07653> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on xaxa.search.ch X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Virus-Scanned: by AMaViS 0.3.12pre8 Subject: Re: idate problems From: cschneid@cschneid.com (Christian Schneider) Nuno Lopes wrote: > 1) (i)date('L') should return the same (1 if is leap year, 0 otherwise), but > they aren't outputing the same > echo date('L'); //1 > echo idate('L'); //0 Yes, this is indeed a bug in the isleap macro (you needed to call it with double parens), the fix is diff -u -r1.120 datetime.c --- ext/standard/datetime.c 31 Mar 2004 17:57:33 -0000 1.120 +++ ext/standard/datetime.c 24 Jun 2004 12:10:55 -0000 @@ -64,7 +64,7 @@ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} }; -#define isleap(year) (((year % 4) == 0 && (year % 100) != 0) || (year % 400)==0) +#define isleap(year) ((((year) % 4) == 0 && ((year) % 100) != 0) || ((year) % 400)==0) #define YEAR_BASE 1900 /* {{{ proto int time(void) > 2) idate('y') is supposed to return the year with *two*digits, althought it > returns just 4. This can be fixed with a simple sprintf? An integer cannot have leading zeros so the behaviour is correct. The documentation could be changed to reflect the fact the the integer value of the last two digits is returned, not the actual two digits (which would be a string and you should use date() for that). - Chris