#49079 [Opn->Bgs]: date calls for year (Y) returns 0000
| From: | scottmac@php.net | Date: | Mon, 27 Jul 2009 22:45:06 +0000 |
| Subject: | #49079 [Opn->Bgs]: date calls for year (Y) returns 0000 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-140346@lists.php.net to get a copy of this message | ||
ID: 49079
Updated by: scottmac@php.net
Reported By: hennessy at thoughtcrime dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Solaris 10
PHP Version: 5.2.10
New Comment:
It's already been reported in bug #48276
The patch that we used is available
http://svn.php.net/viewvc/php/php-src/trunk/ext/date/php_date.c?r1=282532&r2=282538&view=patch
Previous Comments:
------------------------------------------------------------------------
[2009-07-27 22:32:18] hennessy at thoughtcrime dot com
Much obliged, though local corporate policy demands the use of the
latest stable version.. When the next stable point release (assume
5.2.11) goes live I'll probably pull that but for now the patch will
probably work OK...
(and no, I didn't write the policy, I just suffer under it :p))
------------------------------------------------------------------------
[2009-07-27 22:29:47] derick@php.net
Please try using this snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-07-27 21:59:10] hennessy at thoughtcrime dot com
Description:
------------
When referencing a 4-digit year on a Solaris 10 host with php 5.2.10,
one of my developers was getting '0000' .
Bug 48276 relates to this but was submitted for php5.3 .
I put a patch in the 'Reproduce code' section that 'fixes' it..
Reproduce code:
---------------
--- php-5.2.10/ext/date/php_date.c 2009-07-27 17:55:06.192343000
-0400
+++ php-5.2.10.1/ext/date/php_date.c 2009-07-27 16:44:23.297327000
-0400
@@ -798,7 +798,8 @@
/* year */
case 'L': length = slprintf(buffer, 32, "%d",
timelib_is_leap((int) t->y)); break;
case 'y': length = slprintf(buffer, 32, "%02d",
(int) t->y % 100); break;
- case 'Y': length = slprintf(buffer, 32,
"%s%04ld", t->y < 0 ? "-" : "", llabs(t->y)); break;
+ /* case 'Y': length = slprintf(buffer, 32,
"%s%04ld", t->y < 0 ? "-" : "", llabs(t->y)); break; */
+ case 'Y': length = slprintf(buffer, 32, "%d",
(int) t->y); break;
/* time */
case 'a': length = slprintf(buffer, 32, "%s",
t->h >= 12 ? "pm" : "am"); break;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49079&edit=1