From: Greg Beaver Date: Sun, 15 Feb 2009 18:51:46 +0000 (+0000) Subject: fix setting of 32-bit value on big-endian systems X-Git-Tag: RELEASE_1_3_5~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3cea8b054e4b1574288e4b64dd2541e368d7f2f;p=php fix setting of 32-bit value on big-endian systems --- diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index 80a552ccea..a9894a2077 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -6,10 +6,10 @@ PHP_ARG_ENABLE(phar, for phar archive support, if test "$PHP_PHAR" != "no"; then PHP_C_BIGENDIAN - if test $ac_cv_c_bigendian_php = yes; then - AC_MSG_WARN([Disabling Phar due to crash bugs on big endian systems]) - PHP_PHAR=no - else +dnl if test $ac_cv_c_bigendian_php = yes; then +dnl AC_MSG_WARN([Disabling Phar due to crash bugs on big endian systems]) +dnl PHP_PHAR=no +dnl else PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared) AC_MSG_CHECKING([for phar openssl support]) if test "$PHP_HASH_SHARED" != "yes"; then @@ -32,5 +32,5 @@ if test "$PHP_PHAR" != "no"; then PHP_ADD_EXTENSION_DEP(phar, hash, true) PHP_ADD_EXTENSION_DEP(phar, spl, true) PHP_ADD_MAKEFILE_FRAGMENT - fi +dnl fi fi diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 8a53989766..84789b1411 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -1084,10 +1084,10 @@ nostub: #ifdef WORDS_BIGENDIAN # define PHAR_SET_32(var, buffer) \ - *(php_uint32 *)(var) = (((((unsigned char*)(buffer))[3]) << 24) \ - | ((((unsigned char*)(buffer))[2]) << 16) \ - | ((((unsigned char*)(buffer))[1]) << 8) \ - | (((unsigned char*)(buffer))[0])) + *(php_uint32 *)(var) = (((((unsigned char*)&(buffer))[3]) << 24) \ + | ((((unsigned char*)&(buffer))[2]) << 16) \ + | ((((unsigned char*)&(buffer))[1]) << 8) \ + | (((unsigned char*)&(buffer))[0])) #else # define PHAR_SET_32(var, buffer) *(php_uint32 *)(var) = (php_uint32) (buffer) #endif