Commit 51761e7fff9 for php

commit 51761e7fff9432433080b2712ad2ed4941854f82
Merge: ad61a50ec91 155ee2d0781
Author: Arnaud Le Blanc <arnaud.lb@gmail.com>
Date:   Tue Dec 1 12:10:55 2026 +0100

    Merge branch 'PHP-8.5' into PHP-8.6

    * PHP-8.5:
      Fix GH-24319: Make OPcache hash entry publication and indirection atomic (#25258)

diff --cc NEWS
index 4edd3041676,ad95e81fa2d..5c18dc9cf1a
--- a/NEWS
+++ b/NEWS
@@@ -202,21 -175,12 +202,23 @@@ PH
    . Fix JIT register allocation for ASSIGN to traced reference. (ndossche)
    . Fixed a double free when a destructor throws while freeing a temporary
      whose result the optimizer discarded. (Ilia Alshanetsky)
 +  . Fixed bug GH-25756 (OPcache: "Invalid opcode 62/4/0" when assigning a
 +    reference in a return). (Ilia Alshanetsky, Pratik Bhujel)
+   . Fixed bug GH-24319 (zend_accel_hash_update() links new entries without a
+     release barrier). (Levi Morrison)

  - OpenSSL:
 +  . Fixed bug GH-25172 (TLS session reuse shares request-lifetime callback
 +    structures with persistent streams). (cxxz16, David Carlier)
 +  . Fixed an exception thrown by the session_get_cb stream context callback
 +    being replaced with a TypeError. (Ilia Alshanetsky)
 +  . Fixed use-after-free when a stream is closed by the callback for
 +    `early_data_cb`, `psk_client_cb`, `psk_server_cb`, `session_get_cb`, or
 +    `session_new_cb`. (DanielEScherzer)
    . Fixed bug GH-20920 (LibreSSL build regression with PHP 8.5).
      (Eugene Gvozdetsky, Theo Buehler, Jakub Zelenka)
 +  . Fixed SNI_server_certs being ignored on a server stream that reuses the
 +    SSL context of a session stream. (Jakub Zelenka)

  - PDO:
    . Fixed bug GH-25650 (PDO::query() reports the wrong argument numbers for
diff --cc ext/opcache/ZendAccelerator.c
index 3c1bdc1741b,ac7fb14ca91..d074fd24ea7
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@@ -2989,9 -2732,9 +2989,9 @@@ static zend_string* persistent_zend_res
  				/* lookup by "not-real" path */
  				key = accel_make_persistent_key(filename);
  				if (key) {
 -					zend_accel_hash_entry *bucket = zend_accel_hash_find_entry(&ZCSG(hash), key);
 +					const zend_accel_hash_entry *bucket = zend_accel_hash_find_entry(&ZCSG(hash), key);
  					if (bucket != NULL) {
- 						zend_persistent_script *persistent_script = (zend_persistent_script *)bucket->data;
+ 						zend_persistent_script *persistent_script = zend_accel_hash_entry_data(bucket);
  						if (!persistent_script->corrupted) {
  							ZCG(cache_opline) = EG(current_execute_data) ? EG(current_execute_data)->opline : NULL;
  							ZCG(cache_persistent_script) = persistent_script;
diff --cc ext/opcache/zend_accelerator_hash.c
index e35528f7f41,f414d7df72b..52bfe773b2e
--- a/ext/opcache/zend_accelerator_hash.c
+++ b/ext/opcache/zend_accelerator_hash.c
@@@ -182,39 -181,7 +179,7 @@@ void* zend_accel_hash_find(const zend_a
  /* Returns the hash entry associated with key on success
   * Returns NULL if it doesn't exist
   */
 -zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, zend_string *key)
 +zend_accel_hash_entry* zend_accel_hash_find_entry(const zend_accel_hash *accel_hash, zend_string *key)
  {
 -	return (zend_accel_hash_entry *)zend_accel_hash_find_ex(accel_hash, key, 0);
 +	return (zend_accel_hash_entry *)zend_accel_hash_find_ex(accel_hash, key, false);
  }
-
- zend_result zend_accel_hash_unlink(zend_accel_hash *accel_hash, zend_string *key)
- {
- 	zend_ulong hash_value;
- 	zend_ulong index;
- 	zend_accel_hash_entry *entry, *last_entry=NULL;
-
- 	hash_value = zend_string_hash_val(key);
- #ifndef ZEND_WIN32
- 	hash_value ^= ZCG(root_hash);
- #endif
- 	index = hash_value % accel_hash->max_num_entries;
-
- 	entry = accel_hash->hash_table[index];
- 	while (entry) {
- 		if (entry->hash_value == hash_value
- 		 && zend_string_equals(entry->key, key)) {
- 			if (!entry->indirect) {
- 				accel_hash->num_direct_entries--;
- 			}
- 			if (last_entry) {
- 				last_entry->next = entry->next;
- 			} else {
- 				accel_hash->hash_table[index] = entry->next;
- 			}
- 			return SUCCESS;
- 		}
- 		last_entry = entry;
- 		entry = entry->next;
- 	}
- 	return FAILURE;
- }
diff --cc ext/opcache/zend_accelerator_hash.h
index 6091361a68c,66e34b4d155..c4f8d897e67
--- a/ext/opcache/zend_accelerator_hash.h
+++ b/ext/opcache/zend_accelerator_hash.h
@@@ -74,19 -129,15 +127,15 @@@ void* zend_accel_hash_find
  		zend_string            *key);

  zend_accel_hash_entry* zend_accel_hash_find_entry(
 -		zend_accel_hash        *accel_hash,
 +		const zend_accel_hash        *accel_hash,
  		zend_string            *key);

- zend_result zend_accel_hash_unlink(
- 		zend_accel_hash        *accel_hash,
- 		zend_string            *key);
-
 -static inline bool zend_accel_hash_is_full(zend_accel_hash *accel_hash)
 +static inline bool zend_accel_hash_is_full(const zend_accel_hash *accel_hash)
  {
  	if (accel_hash->num_entries == accel_hash->max_num_entries) {
 -		return 1;
 +		return true;
  	} else {
 -		return 0;
 +		return false;
  	}
  }