mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Fix #70173: ZVAL_COPY_VALUE_EX broken for 32bit Solaris Sparc
On 32bit big endian architectures the high word of a zend_value is copied twice, instead of copying both words. Let's fix it.
This commit is contained in:
parent
64a5189358
commit
79f64e5e67
13
Zend/tests/bug70173.phpt
Normal file
13
Zend/tests/bug70173.phpt
Normal file
@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #70173 (ZVAL_COPY_VALUE_EX broken for 32bit Solaris Sparc)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$var = 2900000000;
|
||||
var_dump($var);
|
||||
?>
|
||||
--EXPECT--
|
||||
float(2900000000)
|
@ -822,13 +822,23 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
|
||||
}
|
||||
|
||||
#if SIZEOF_SIZE_T == 4
|
||||
# define ZVAL_COPY_VALUE_EX(z, v, gc, t) \
|
||||
# ifdef WORDS_BIGENDIAN
|
||||
# define ZVAL_COPY_VALUE_EX(z, v, gc, t) \
|
||||
do { \
|
||||
uint32_t _w1 = v->value.ww.w1; \
|
||||
Z_COUNTED_P(z) = gc; \
|
||||
z->value.ww.w1 = _w1; \
|
||||
Z_TYPE_INFO_P(z) = t; \
|
||||
} while (0)
|
||||
# else
|
||||
# define ZVAL_COPY_VALUE_EX(z, v, gc, t) \
|
||||
do { \
|
||||
uint32_t _w2 = v->value.ww.w2; \
|
||||
Z_COUNTED_P(z) = gc; \
|
||||
z->value.ww.w2 = _w2; \
|
||||
Z_TYPE_INFO_P(z) = t; \
|
||||
} while (0)
|
||||
# endif
|
||||
#elif SIZEOF_SIZE_T == 8
|
||||
# define ZVAL_COPY_VALUE_EX(z, v, gc, t) \
|
||||
do { \
|
||||
|
Loading…
Reference in New Issue
Block a user