Commit cfb02068f90 for php

commit cfb02068f907af3e7bec24d43e4b5a185abdbba8
Merge: d6ff86a581e 753d7865f01
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date:   Tue Nov 17 10:45:54 2026 -0800

    Merge branch 'PHP-8.5' into PHP-8.6

    * PHP-8.5:
      Fix ReflectionMethod::getClosure() on abstract methods (#25494)

diff --cc NEWS
index 9b52776e7b0,a6f74d96778..d4c0610f978
--- a/NEWS
+++ b/NEWS
@@@ -136,12 -109,11 +136,15 @@@ PH
      which could cause readline() to return false prematurely. (Weilin Du)

  - Reflection:
 +  . Fixed bug GH-25266 (Misaligned read in ReflectionProperty::isReadable()).
 +    (Lazizbek Ergashev)
    . Fix trampoline leak when object construction fails for lazy object.
      (ndossche)
 +  . Fix ReflectionProperty::isReadable() not working for indirect slots.
 +    (ndossche)
+   . Fixed ReflectionMethod::getClosure() returning a closure for abstract
+     methods, which crashed when called for the ones of internal classes.
+     (Nicolas Grekas)

  - Session:
    . Fixed session upload progress to respect session.use_only_cookies.
diff --cc ext/reflection/php_reflection.c
index ee93160d5a5,d8025504cd5..c142c78449d
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@@ -3321,27 -3492,35 +3321,34 @@@ ZEND_METHOD(ReflectionMethod, getClosur

  	GET_REFLECTION_OBJECT_PTR(mptr);

+ 	if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ 		zend_throw_exception_ex(reflection_exception_ptr, 0,
+ 			"Trying to create a closure from abstract method %s::%s()",
+ 			ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
+ 		RETURN_THROWS();
+ 	}
+
 -	if (mptr->common.fn_flags & ZEND_ACC_STATIC)  {
 +	if (mptr->common.fn_flags & ZEND_ACC_STATIC) {
  		zend_create_fake_closure(return_value, mptr, mptr->common.scope, mptr->common.scope, NULL);
 -	} else {
 -		if (!obj) {
 -			zend_argument_value_error(1, "cannot be null for non-static methods");
 -			RETURN_THROWS();
 -		}
 +		return;
 +	}
 +	if (!obj) {
 +		zend_argument_value_error(1, "cannot be null for non-static methods");
 +		RETURN_THROWS();
 +	}

 -		if (!instanceof_function(Z_OBJCE_P(obj), mptr->common.scope)) {
 -			_DO_THROW("Given object is not an instance of the class this method was declared in");
 -			RETURN_THROWS();
 -		}
 +	if (!instanceof_function(Z_OBJCE_P(obj), mptr->common.scope)) {
 +		zend_throw_exception(reflection_exception_ptr, "Given object is not an instance of the class this method was declared in", 0);
 +		RETURN_THROWS();
 +	}

 -		/* This is an original closure object and __invoke is to be called. */
 -		if (Z_OBJCE_P(obj) == zend_ce_closure &&
 -			(mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))
 -		{
 -			RETURN_OBJ_COPY(Z_OBJ_P(obj));
 -		} else {
 -			zend_create_fake_closure(return_value, mptr, mptr->common.scope, Z_OBJCE_P(obj), obj);
 -		}
 +	/* This is an original closure object and __invoke is to be called. */
 +	if (Z_OBJCE_P(obj) == zend_ce_closure &&
 +		(mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))
 +	{
 +		RETURN_OBJ_COPY(Z_OBJ_P(obj));
  	}
 +	zend_create_fake_closure(return_value, mptr, mptr->common.scope, Z_OBJCE_P(obj), Z_OBJ_P(obj));
  }
  /* }}} */