Commit fe96b7a7bcb for php.net

commit fe96b7a7bcb627a3ffc7c65d7da12a08038fa405
Merge: 5efde93f089 b800171652f
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date:   Tue Sep 22 08:32:06 2026 -0400

    Merge branch 'PHP-8.5' into PHP-8.6

    * PHP-8.5:
      ext/intl: Reject unconstructed Collator in attribute and strength methods

diff --cc ext/intl/collator/collator_attr.cpp
index 14b8abf497b,0bc68026092..04ce848abe0
--- a/ext/intl/collator/collator_attr.cpp
+++ b/ext/intl/collator/collator_attr.cpp
@@@ -47,7 -40,11 +47,11 @@@ U_CFUNC PHP_FUNCTION( collator_get_attr
  	/* Fetch the object. */
  	COLLATOR_METHOD_FETCH_OBJECT;

+ 	if (collator_check_initialized(co) == FAILURE) {
+ 		RETURN_THROWS();
+ 	}
+
 -	value = ucol_getAttribute( co->ucoll, attribute, COLLATOR_ERROR_CODE_P( co ) );
 +	value = ucol_getAttribute( co->ucoll, static_cast<UColAttribute>(attribute), COLLATOR_ERROR_CODE_P( co ) );
  	COLLATOR_CHECK_STATUS( co, "Error getting attribute value" );

  	RETURN_LONG( value );
@@@ -71,8 -68,12 +75,12 @@@ U_CFUNC PHP_FUNCTION( collator_set_attr
  	/* Fetch the object. */
  	COLLATOR_METHOD_FETCH_OBJECT;

+ 	if (collator_check_initialized(co) == FAILURE) {
+ 		RETURN_THROWS();
+ 	}
+
  	/* Set new value for the given attribute. */
 -	ucol_setAttribute( co->ucoll, attribute, value, COLLATOR_ERROR_CODE_P( co ) );
 +	ucol_setAttribute( co->ucoll, static_cast<UColAttribute>(attribute), static_cast<UColAttributeValue>(value), COLLATOR_ERROR_CODE_P( co ) );
  	COLLATOR_CHECK_STATUS( co, "Error setting attribute value" );

  	RETURN_TRUE;
@@@ -116,8 -121,12 +128,12 @@@ U_CFUNC PHP_FUNCTION( collator_set_stre
  	/* Fetch the object. */
  	COLLATOR_METHOD_FETCH_OBJECT;

+ 	if (collator_check_initialized(co) == FAILURE) {
+ 		RETURN_THROWS();
+ 	}
+
  	/* Set given strength. */
 -	ucol_setStrength( co->ucoll, strength );
 +	ucol_setStrength( co->ucoll, static_cast<UColAttributeValue>(strength) );

  	RETURN_TRUE;
  }
diff --cc ext/intl/collator/collator_class.h
index 637d5dc490a,106ac926aac..c4be06fd129
--- a/ext/intl/collator/collator_class.h
+++ b/ext/intl/collator/collator_class.h
@@@ -47,12 -41,26 +47,27 @@@ typedef struct
  #define COLLATOR_ERROR_CODE(co)   INTL_ERROR_CODE(COLLATOR_ERROR(co))
  #define COLLATOR_ERROR_CODE_P(co) &(INTL_ERROR_CODE(COLLATOR_ERROR(co)))

 -static inline Collator_object *php_intl_collator_fetch_object(zend_object *obj) {
 -	return (Collator_object *)((char*)(obj) - XtOffsetOf(Collator_object, zo));
 -}
 +#define php_intl_collator_fetch_object(obj) ZEND_CONTAINER_OF(obj, Collator_object, zo)
  #define Z_INTL_COLLATOR_P(zv) php_intl_collator_fetch_object(Z_OBJ_P(zv))

+ static zend_always_inline zend_result collator_check_initialized(Collator_object *co)
+ {
+ 	ZEND_ASSERT(co != NULL);
+
+ 	if (UNEXPECTED(co->ucoll == NULL)) {
+ 		intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) );
+ 		intl_errors_set_custom_msg(COLLATOR_ERROR_P( co ), "Object not initialized");
+ 		zend_throw_error(NULL, "Object not initialized");
+
+ 		return FAILURE;
+ 	}
+
+ 	return SUCCESS;
+ }
+
 +#ifdef __cplusplus
 +extern "C" {
 +#endif
  void collator_register_Collator_symbols(int module_number);
  void collator_object_init( Collator_object* co );
  void collator_object_destroy( Collator_object* co );