Commit 6df13110d10 for php.net

commit 6df13110d10fb2eef403dc4ca6ec1226682f1d6d
Merge: 3d3d336e24b dab13a022a5
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date:   Wed Sep 2 09:17:20 2026 -0700

    Merge branch 'PHP-8.5'

    * PHP-8.5:
      Keep EG(errors) buffer consistent on erealloc failure (#23257)

diff --cc Zend/zend.c
index 1718972e592,aa621c4daa8..42e6fb568a2
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@@ -1487,13 -1483,13 +1487,14 @@@ ZEND_API ZEND_COLD void zend_error_zstr
  		info->lineno = error_lineno;
  		info->filename = zend_string_copy(error_filename);
  		info->message = zend_string_copy(message);
- 		EG(errors).size++;
- 		if (EG(errors).size > EG(errors).capacity) {
 -
 -		/* This is very inefficient for a large number of errors.
 -		 * Use pow2 realloc if it becomes a problem. */
 -		uint32_t new_num_errors = EG(num_errors) + 1;
 -		EG(errors) = safe_erealloc(EG(errors), new_num_errors, sizeof(zend_error_info*), 0);
 -		EG(errors)[EG(num_errors)] = info;
 -		EG(num_errors) = new_num_errors;
++		uint32_t new_size = EG(errors).size + 1;
++		if (new_size > EG(errors).capacity) {
 +			uint32_t capacity = EG(errors).capacity ? EG(errors).capacity + (EG(errors).capacity >> 1) : 2;
 +			EG(errors).errors = erealloc(EG(errors).errors, sizeof(zend_error_info *) * capacity);
 +			EG(errors).capacity = capacity;
 +		}
- 		EG(errors).errors[EG(errors).size - 1] = info;
++		EG(errors).errors[EG(errors).size] = info;
++		EG(errors).size = new_size;

  		/* Do not process non-fatal recorded error */
  		if (!(type & E_FATAL_ERRORS) || (type & E_DONT_BAIL)) {