[wp-trac] [WordPress Trac] #54798: Check for int in menu priority

WordPress Trac noreply at wordpress.org
Wed Jun 22 14:54:04 UTC 2022


#54798: Check for int in menu priority
--------------------------------------+-----------------------
 Reporter:  kirtan95                  |       Owner:  audrasjb
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.0
Component:  Administration            |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------

Comment (by SergeyBiryukov):

 In [changeset:"53555" 53555]:
 {{{
 #!CommitTicketReference repository="" revision="53555"
 Code Modernization: Use the integer portion of an item position in
 `add_submenu_page()`.

 This fixes an `Implicit conversion from float to int loses precision` PHP
 8.1 deprecation notice when adding a new admin menu item with a `float`
 value passed as the `$position` parameter.

 This change is covered by existing unit tests and addresses 8 errors when
 running the test suite on PHP 8.1.

 References:
 * [https://php.watch/versions/8.1/deprecate-implicit-conversion-
 incompatible-float-string PHP 8.1: Implicit incompatible float to int
 conversion is deprecated]
 * [https://wiki.php.net/rfc/implicit-float-int-deprecate PHP RFC:
 Deprecate implicit non-integer-compatible float to int conversions]

 Follow-up to [52569], [53104].

 Props jrf.
 See #55656, #54798.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54798#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list