Make WordPress Core

Ticket #55656: 54798-follow-up-fix-php81-deprecation.patch

File 54798-follow-up-fix-php81-deprecation.patch, 1014 bytes (added by jrf, 2 years ago)

Fix newly introduced PHP 8.1 incompatibility introduced in [52567] / #54798

  • src/wp-admin/includes/plugin.php

    From 5d55d3cff3586dc4ec6e7f077fa8eee2b6be8ce7 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Fri, 17 Jun 2022 03:59:03 +0200
    Subject: [PATCH] PHP 8.1 | add_submenu_page(): fix float to int conversion
     with loss of precision
    
    ---
     src/wp-admin/includes/plugin.php | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
    index 7834abe6f2..3053971e48 100644
    a b function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, 
    14541454                        // For negative or `0` positions, prepend the submenu.
    14551455                        array_unshift( $submenu[ $parent_slug ], $new_sub_menu );
    14561456                } else {
     1457                        $position = absint( $position );
    14571458                        // Grab all of the items before the insertion point.
    14581459                        $before_items = array_slice( $submenu[ $parent_slug ], 0, $position, true );
    14591460                        // Grab all of the items after the insertion point.