wp/wp-admin/includes/class-wp-site-icon.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
--- a/wp/wp-admin/includes/class-wp-site-icon.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/includes/class-wp-site-icon.php	Fri Sep 05 18:40:08 2025 +0200
@@ -12,6 +12,7 @@
  *
  * @since 4.3.0
  */
+#[AllowDynamicProperties]
 class WP_Site_Icon {
 
 	/**
@@ -77,12 +78,15 @@
 	 * Creates an attachment 'object'.
 	 *
 	 * @since 4.3.0
+	 * @deprecated 6.5.0
 	 *
 	 * @param string $cropped              Cropped image URL.
 	 * @param int    $parent_attachment_id Attachment ID of parent image.
 	 * @return array An array with attachment object data.
 	 */
 	public function create_attachment_object( $cropped, $parent_attachment_id ) {
+		_deprecated_function( __METHOD__, '6.5.0', 'wp_copy_parent_attachment_properties()' );
+
 		$parent     = get_post( $parent_attachment_id );
 		$parent_url = wp_get_attachment_url( $parent->ID );
 		$url        = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
@@ -200,9 +204,9 @@
 	 * @param int $post_id Attachment ID.
 	 */
 	public function delete_attachment_data( $post_id ) {
-		$site_icon_id = get_option( 'site_icon' );
+		$site_icon_id = (int) get_option( 'site_icon' );
 
-		if ( $site_icon_id && $post_id == $site_icon_id ) {
+		if ( $site_icon_id && $post_id === $site_icon_id ) {
 			delete_option( 'site_icon' );
 		}
 	}
@@ -221,9 +225,9 @@
 	 */
 	public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
 		if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) {
-			$site_icon_id = get_option( 'site_icon' );
+			$site_icon_id = (int) get_option( 'site_icon' );
 
-			if ( $post_id == $site_icon_id ) {
+			if ( $post_id === $site_icon_id ) {
 				add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
 			}
 		}