#48708 [Fbk->Opn]: Year can't be displayed on big endian system
| From: | l_faillie at yahoo dot com | Date: | Sun, 28 Jun 2009 20:00:29 +0000 |
| Subject: | #48708 [Fbk->Opn]: Year can't be displayed on big endian system | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-138899@lists.php.net to get a copy of this message | ||
ID: 48708
User updated by: l_faillie at yahoo dot com
Reported By: l_faillie at yahoo dot com
-Status: Feedback
+Status: Open
Bug Type: Date/time related
Operating System: All
PHP Version: 5.2.10
New Comment:
Unfortunately, I'm not able to compile latest 5.3 due to GCC bug this
time :
gcc: Internal error: Killed (program cc1)
Please submit a full bug report.
See <URL:http://www.netbsd.org/Misc/send-pr.html> for
instructions.
gmake: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
I'm planing to upgrade my system in coming weeks (during my holidays)
implying a new GCC but it's not before at least 1 month.
As a workaround of this bug, I'm suggesting doing year display as
integer as it was on 5.2.9.
Bye
Laurent
Previous Comments:
------------------------------------------------------------------------
[2009-06-27 20:59:45] derick@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-06-27 16:04:36] l_faillie at yahoo dot com
In ext/date/php_date.c, t->y (years) are stored as wide_int which is
'long long int' 64 bits but vararg or main/snprintf.c retrieve it as
'long int' (32 bits).
As consequence, on big endian system, only upper part is take in
account and contains only 0.
Tested on NetBSD / Sparc system but I guess reproducible on all big
endian system (IBM, sparc, 68000, ...).
Bye the way, what is the need having 64b years which as been introduced
w/ 5.2.10 ?
Bye
Laurent
------------------------------------------------------------------------
[2009-06-27 15:58:02] l_faillie at yahoo dot com
Description:
------------
In ext/date/php_date.c, years are stored as 64b integers but displayed
using "%04ld" (32b integers). Only work on little endian system
Reproduce code:
---------------
echo date('Y y o');
"0000 09 2009".
Expected result:
----------------
"2009 09 2009"
Actual result:
--------------
"0000 09 2009"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48708&edit=1