|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-01-05 07:40 UTC] lidan at cn dot fujitsu dot com
-Summary: on PowerPC linux, date() functions calls Segmentation
fault
+Summary: on PowerPC linux, date() function causes Segmentation
fault
[2014-01-05 07:40 UTC] lidan at cn dot fujitsu dot com
[2014-01-19 14:51 UTC] felipe@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: derick
[2017-10-24 08:08 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: derick
+Assigned To:
[2020-01-29 13:04 UTC] ab@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: ab
[2020-01-29 13:04 UTC] ab@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
Description: ------------ OS: linux 3.0.8 Arch:PowerPC PHP version: 5.5.7 configure: ./configure --host=powerpc-linux --disable-all CC=powerpc-e500v2-linux-gnuspe-gcc Problem: on x86 it is OK. But, on PowerPC it caused segmentation fault. 1.$./sapi/cli/php -r 'date("Y");' Segmentation Fault It is because in ext/date/lib/parse_tz.c Line 35: #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) # if defined(__LITTLE_ENDIAN__) # undef WORDS_BIGENDIAN # else # if defined(__BIG_ENDIAN__) # define WORDS_BIGENDIAN # endif PowerPC is big endian, so __BIG_ENDIAN__ is defined. But __APPLE__ or __APPLE_CC__ is not defined. In result, WORD_BIGENDIAN is not defined. So, in line 45, timelib_conv_int() used the little endian version. The segmentation fault is caused. #ifdef WORDS_BIGENDIAN #define timelib_conv_int(l) (l) #else #define timelib_conv_int(l) ((l & 0x000000ff) << 24) + ((l & 0x0000ff00) << + ((l & 0x00ff0000) >> 8) + ((l & 0xff000000) >> 24) #endif Test script: --------------- ./sapi/cli/php -r 'date("Y");' Expected result: ---------------- 2014 Actual result: -------------- Segmentation Fault