#38975 [Com]: date() function causes php crash

From: Date: Sat, 30 Dec 2006 01:55:28 +0000
Subject: #38975 [Com]: date() function causes php crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107023@lists.php.net to get a copy of this message
ID: 38975 Comment by: sutekin at gmail dot com Reported By: rachmel at avaya dot com Status: Assigned Bug Type: Reproducible crash Operating System: WindRiver Linux PHP Version: 5.1.6 Assigned To: derick New Comment: Hi, My friend got problems about corrupted timezone info. Whe we restart machine it works corrctly but after an apache restart, we got error. My friend uses tr_TR.UTF-8 as locale settings. We have it working correctly when we set it C or tr_TR.ISO8859-9 . I think source of the problem is UTF-8 , that PHP is weak to cover, response of time data. As I remember, PARDUS Linux(www.pardus.org.tr) Team has solved various UTF-8 problems about various applications in their distribution. PHP Group may consider to work with them... Previous Comments: ------------------------------------------------------------------------ [2006-10-25 10:41:03] rachmel at avaya dot com Hi, I think I found the problem. in one of the date extention files: parse_tz.c , there is a conversion macro called: timelib_conv_int() that has two modes - depends if WORDS_BIGENDIAN is defined or not. I located the test that defines it in the php configure file, and it looks like this: echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 echo "configure:43563: checking whether byte ordering is bigendian" >&5 if eval "test \"echo '$''{'ac_cv_c_bigendian_php'+set}'\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian_php=unknown if test "$cross_compiling" = yes; then ac_cv_c_bigendian_php=unknown else cat > conftest.$ac_ext <<EOF So, what happens is - i cross compile, and then the bigendian becomes uknown => the WORDS_BIGENDIAN is not defined => the timezone database is read in the wrong way => malloc tries to use that information to allocate memory and fails. Can you explain why it is that way? ------------------------------------------------------------------------ [2006-10-18 17:04:44] tony2001@php.net No, I don't think it matters. ------------------------------------------------------------------------ [2006-10-18 17:00:03] rachmel at avaya dot com ok, I will look into it. Do you think that using the timezonedb upgrade should make any difference? Thanks. ------------------------------------------------------------------------ [2006-10-18 16:57:38] tony2001@php.net date() is in ext/date/php_date.c And I don't see any problems on all OSes around, including 5 Linuxes on different architectures. ------------------------------------------------------------------------ [2006-10-18 16:52:41] rachmel at avaya dot com I am not sure I can do that - in the meantime, it seems that if php has a default timezone conigured, it ignores the localtime definitions on the Linux kernel. However, if I change the default timezone to "Pacific/Fiji" for example, i can reproduce the crash with a call to "date("1"). it is interesting, that a call to phpinfo() doesn't crash, although it does display the time zone chosen. Are there any leads you can think about that might cause this problem? Where in the php code can I find the date function, so I can try and debug it from there? Thanks. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/38975 -- Edit this bug report at http://bugs.php.net/?id=38975&edit=1

« previous php.bugs (#107023) next »