From a08ffc705275c26142abb81f2194f679823b2438 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 2 Aug 2022 10:31:16 +0200 Subject: [PATCH 1/3] [ci-skip] Fix for bug #80047 was included in previous release We are removing the entry in 8.0.23, as the fix was included in the 8.0.22 release. Given that an entry already exists, we are just deleting extra lines. --- NEWS | 4 ---- 1 file changed, 4 deletions(-) diff --git a/NEWS b/NEWS index 8cbac266d73..e63742c4412 100644 --- a/NEWS +++ b/NEWS @@ -2,10 +2,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2022, PHP 8.0.23 -- Date: - . Fixed bug #80047 (DatePeriod doesn't warn with custom DateTimeImmutable). - (Derick) - - DBA: . Fixed LMDB driver memory leak on DB creation failure (Girgias) . Fixed bug GH-9155 (dba_open("non-existing", "c-", "flatfile") segfaults). From 3725717de18fd60a679a02210b3ed14517972524 Mon Sep 17 00:00:00 2001 From: Go Kudo Date: Thu, 4 Aug 2022 23:56:19 +0900 Subject: [PATCH 2/3] Remove ZEND_DVAL_TO_LVAL_CAST_OK (#9215) * Remove ZEND_DVAL_TO_LVAL_CAST_OK As far as I can see, this operation should always use the _slow method, and the results seem to be wrong when ZEND_DVAL_TO_LVAL_CAST_OK is enabled. * update NEWS --- NEWS | 1 + Zend/Zend.m4 | 34 ---------------------------------- Zend/zend_operators.c | 4 +--- Zend/zend_operators.h | 11 ----------- 4 files changed, 2 insertions(+), 48 deletions(-) diff --git a/NEWS b/NEWS index e63742c4412..778279e010f 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ PHP NEWS - Standard: . Fixed bug GH-9017 (php_stream_sock_open_from_socket could return NULL). (Heiko Weber) + . Fixed incorrect double to long casting in latest clang. (zeriyoshi) 04 Aug 2022, PHP 8.0.22 diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 781e51d3e44..ee0fdcabff8 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -149,40 +149,6 @@ dnl Checks for library functions. AC_CHECK_FUNCS(getpid kill sigsetjmp) ZEND_CHECK_FLOAT_PRECISION - -dnl Test whether double cast to long preserves least significant bits. -AC_MSG_CHECKING(whether double cast to long preserves least significant bits) - -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include - -int main() -{ - if (sizeof(long) == 4) { - double d = (double) LONG_MIN * LONG_MIN + 2e9; - - if ((long) d == 2e9 && (long) -d == -2e9) { - return 0; - } - } else if (sizeof(long) == 8) { - double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */ - - if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */ - return 0; - } - } - return 1; -} -]])], [ - AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits]) - AC_MSG_RESULT(yes) -], [ - AC_MSG_RESULT(no) -], [ - AC_MSG_RESULT(no) -]) - ]) dnl diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 423ed918da3..272d5ede972 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -3222,8 +3222,7 @@ ZEND_API const char* ZEND_FASTCALL zend_memnrstr_ex(const char *haystack, const } /* }}} */ -#ifndef ZEND_DVAL_TO_LVAL_CAST_OK -# if SIZEOF_ZEND_LONG == 4 +#if SIZEOF_ZEND_LONG == 4 ZEND_API zend_long ZEND_FASTCALL zend_dval_to_lval_slow(double d) /* {{{ */ { double two_pow_32 = pow(2., 32.), @@ -3253,4 +3252,3 @@ ZEND_API zend_long ZEND_FASTCALL zend_dval_to_lval_slow(double d) } /* }}} */ #endif -#endif diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index d543b7b03c2..a6589f96777 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -99,16 +99,6 @@ ZEND_API const char* ZEND_FASTCALL zend_memnrstr_ex(const char *haystack, const # define ZEND_DOUBLE_FITS_LONG(d) (!((d) >= (double)ZEND_LONG_MAX || (d) < (double)ZEND_LONG_MIN)) #endif -#ifdef ZEND_DVAL_TO_LVAL_CAST_OK -static zend_always_inline zend_long zend_dval_to_lval(double d) -{ - if (EXPECTED(zend_finite(d)) && EXPECTED(!zend_isnan(d))) { - return (zend_long)d; - } else { - return 0; - } -} -#else ZEND_API zend_long ZEND_FASTCALL zend_dval_to_lval_slow(double d); static zend_always_inline zend_long zend_dval_to_lval(double d) @@ -120,7 +110,6 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) } return (zend_long)d; } -#endif static zend_always_inline zend_long zend_dval_to_lval_cap(double d) { From 1ce2b56227fce6b63bc70462a82d5301ec77a9ef Mon Sep 17 00:00:00 2001 From: zeriyoshi Date: Fri, 5 Aug 2022 00:05:12 +0900 Subject: [PATCH 3/3] [CI skip] update NEWS --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 778279e010f..1c9cf761660 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2022, PHP 8.0.23 +- Core: + . Fixed incorrect double to long casting in latest clang. (zeriyoshi) + - DBA: . Fixed LMDB driver memory leak on DB creation failure (Girgias) . Fixed bug GH-9155 (dba_open("non-existing", "c-", "flatfile") segfaults). @@ -20,7 +23,6 @@ PHP NEWS - Standard: . Fixed bug GH-9017 (php_stream_sock_open_from_socket could return NULL). (Heiko Weber) - . Fixed incorrect double to long casting in latest clang. (zeriyoshi) 04 Aug 2022, PHP 8.0.22