[wp-trac] [WordPress Trac] #54996: PHP8.1 throw 'Deprecated' in WordPress 6.0-alpha-52650

WordPress Trac noreply at wordpress.org
Fri Sep 16 14:47:45 UTC 2022


#54996: PHP8.1 throw 'Deprecated' in WordPress 6.0-alpha-52650
-------------------------------------------------+-------------------------
 Reporter:  haozi                                |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.1
Component:  I18N                                 |     Version:  6.0
 Severity:  trivial                              |  Resolution:
 Keywords:  php81 reporter-feedback needs-patch  |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------

Comment (by cadic):

 From https://www.gnu.org/software/gettext/manual/html_node/Plural-
 forms.html

 > Negative and floating-point values usually represent physical entities
 for which singular and plural don’t clearly apply. In such cases, there is
 no need to use ngettext; a simple gettext call with a form suitable for
 all values will do. For example:
 > `printf (gettext ("Time elapsed: %.3f seconds"), num_milliseconds *
 0.001);`
 > Even if num_milliseconds happens to be a multiple of 1000, the output
 > `Time elapsed: 1.000 seconds`
 > is acceptable in English, and similarly for other languages.

 This means using `(int)` to convert float to integer will break the logic
 and display 1.0 as singular number.

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


More information about the wp-trac mailing list