In the date extension a bad swap is made so that wrong part of the variable is used on big endian machines, instead of getting the year, the "empty space" is given, so that the year will always become to be 0000. Reproducible: Always Steps to Reproduce: 1. Choose a big endian machine, like PowerPC, Sparc, ... 2. emerge =php-5.2.10 3. php -r "echo date('Y').\"\n\";" Actual Results: 0000 Expected Results: 2009 This do not affect small endian machines like x86, amd64, so people with a such architecture should not try to confirm this bug. The bug has been fixed in php 5.2.11 and 5.3.0 and don't affect php 5.2.9 or earlier. There can be php applications which depends on a working php date(), in those cases the php application will be broken for big endian users.
Created attachment 198194 [details, diff] Patch date extension to use the same method as used in 5.2.9 for option Y This patch is only meant for big endian machines, it will not break for small endian machines. This patch should be added to php 5.2.10 ebuild and be marked as a stable version for all big endian system which has 5.2.10 as stable at the moment.
Portage 2.1.6.13 (default/linux/powerpc/ppc32/2008.0/server, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.23.1-gentoo ppc) ================================================================= System uname: Linux-2.6.23.1-gentoo-ppc-7447-7457,_altivec_supported-with-glibc2.0 Timestamp of tree: Tue, 07 Jul 2009 14:45:02 +0000 distcc 3.1 powerpc-unknown-linux-gnu [disabled] app-shells/bash: 3.2_p39 dev-java/java-config: 1.3.7-r1, 2.1.7 dev-lang/python: 2.4.4-r13, 2.5.4-r2 dev-python/pycrypto: 2.0.1-r8 dev-util/cmake: 2.6.4 sys-apps/baselayout: 1.12.11.1 sys-apps/sandbox: 1.6-r2 sys-devel/autoconf: 2.13, 2.63 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2 sys-devel/binutils: 2.18-r3 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.27-r2 ACCEPT_KEYWORDS="ppc" CBUILD="powerpc-unknown-linux-gnu" CFLAGS="-O2 -mcpu=7450 -mtune=7450 -maltivec -mabi=altivec -pipe -fno-strict-aliasing" CHOST="powerpc-unknown-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /var/bind" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-O2 -mcpu=7450 -mtune=7450 -maltivec -mabi=altivec -pipe -fno-strict-aliasing" DISTDIR="/usr/portage/distfiles" FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch" GENTOO_MIRRORS="ftp://trumpetti.atm.tut.fi/gentoo/ ftp://gentoo.imj.fr/pub/gento o/ ftp://mirrors.64hosting.com/pub/mirrors/gentoo/ http://distro.ibiblio.org/pub /linux/distributions/gentoo/ ftp://distro.ibiblio.org/pub/linux/distributions/ge ntoo/ http://ftp.twaren.net/Linux/Gentoo/ ftp://sunsite.informatik.rwth-aachen.d e/pub/Linux/gentoo ftp://ftp.twaren.net/Linux/Gentoo/ http://gentoo.cites.uiuc.e du/pub/gentoo/ ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo" LANG="en_GB.UTF-8" LDFLAGS="-Wl,-O1" LINGUAS="en_GB" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages/ppc" PORTAGE_COMPRESS="gzip" PORTAGE_COMPRESS_FLAGS="-f5" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/local/portage" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="acl alsa altivec apache2 berkdb bzip2 cdr cjk cli cracklib crypt cups emacs ffmpeg fortran gdbm gpm hpn iconv icu insecure-drivers isdnlog jpeg jpg lame ldap mailwrapper mbox midi mpeg mudflap mysql ncurses nls nocd nptl nptlonly oggvorbis openmp pam pcre perl png ppc pppd python readline reflection sdk session snmp spl ssl svg sysfs tcltk tcpd tiff truetype udev unicode urandom usb vim-syntax xml zlib" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="ncurses text" LINGUAS="en_GB" USERLAND="GNU" VIDEO_CARDS="radeon vesa" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_RSYNC_EXTRA_OPTS
Added ppc, ppc64, sparc and m68k to the list (not too good on big endian architectures).
(In reply to comment #1) > This patch is only meant for big endian machines, it will not break for small > endian machines. Yes, it will. PHP started using llabs instead of abs so that very large year numbers could be printed correctly. Change it back and that stops working. Why not use the fix that went into 5.3.0 and will also make it into 5.2.11? http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/ext/date/php_date.c?r1=281735&r2=282540&view=patch
Removing the arch teams from the CC list to reduce bug spam. The PHP folks can notify them when they have a new version ready to be marked stable.
Created attachment 198329 [details, diff] The official patch from php.net Yes, it can be better to use this patch, I rebuild php with it and it works as well as my first patch I made. What worries me is that it takes so long time to see a simple fix as this to makes it way to the stable ebuild for big endian machines.
With drupal v4 (haven't seen any confirmation for other versions, but could be the same) installed on big endian systems, the login feature will stop to work. Please see to that there is a new version released for PHP with the small diff applied.
This should be fixed with php-5.2.11, which is already in the tree. Just waiting for stabilization as such.
I have used the patch and it has worked as supposed for me on both PowerPC and Sparc. Even if we have a 5.2.11 soon stabilized, the patch should be applied as long as there are a 5.2.10 version left in the tree.
php-5.2.11 goes stable now (per bug 285434) anyway, so I don't see the point in adding yet another 5.2.10 revision (which would be stabled later).
*** Bug 289568 has been marked as a duplicate of this bug. ***
The bug has been fixed in php-5.2.11 which is now stable.