Commit 38b2036e6f7 for php
commit 38b2036e6f70de1000cd9177c113f7e5195eae47
Merge: 3ebd95ff865 0a8c4e0281c
Author: Arnaud Le Blanc <arnaud.lb@gmail.com>
Date: Fri Oct 2 16:23:38 2026 +0200
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix GH-24063: SCCP merges 0.0 and -0.0 into a single constant (#24064)
diff --cc Zend/Optimizer/sccp.c
index 72ba6d98888,f18d8f142c9..01ba8e6ba67
--- a/Zend/Optimizer/sccp.c
+++ b/Zend/Optimizer/sccp.c
@@@ -1951,7 -1954,29 +1951,29 @@@ static void sccp_mark_feasible_successo
scdf_mark_edge_feasible(scdf, block_num, block->successors[s]);
}
+ /* Unlike zend_is_identical(), this does not treat 0.0 and -0.0 as the same value.
+ * Returns int to be usable as compare_func_t. */
+ static int sccp_values_differ(const void *p1, const void *p2)
+ {
+ const zval *a = p1;
+ const zval *b = p2;
+
+ if (Z_TYPE_P(a) != Z_TYPE_P(b)) {
+ return 1;
+ }
+ if (Z_TYPE_P(a) == IS_DOUBLE) {
+ return memcmp(&Z_DVAL_P(a), &Z_DVAL_P(b), sizeof(double)) != 0;
+ }
+ if (Z_TYPE_P(a) == IS_ARRAY) {
+ return Z_ARRVAL_P(a) != Z_ARRVAL_P(b)
+ && zend_hash_compare(Z_ARRVAL_P(a), Z_ARRVAL_P(b), sccp_values_differ, 1) != 0;
+ }
+ ZEND_ASSERT(IS_PARTIAL_ARRAY(a) || IS_PARTIAL_OBJECT(a)
+ || ((1 << Z_TYPE_P(a)) & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_BOOL|MAY_BE_LONG|MAY_BE_STRING)));
+ return !zend_is_identical(a, b);
+ }
+
-static void join_hash_tables(HashTable *ret, HashTable *ht1, HashTable *ht2)
+static void join_hash_tables(HashTable *ret, const HashTable *ht1, const HashTable *ht2)
{
zend_ulong index;
zend_string *key;