[wp-trac] [WordPress Trac] #55603: PHP 8.2: address deprecation of the utf8_encode() and utf8_decode() functions

WordPress Trac noreply at wordpress.org
Fri Mar 1 10:46:46 UTC 2024


#55603: PHP 8.2: address deprecation of the utf8_encode() and utf8_decode()
functions
--------------------------------------------+------------------------------
 Reporter:  jrf                             |       Owner:  hellofromTonya
     Type:  task (blessed)                  |      Status:  assigned
 Priority:  normal                          |   Milestone:  6.6
Component:  General                         |     Version:  6.0
 Severity:  normal                          |  Resolution:
 Keywords:  2nd-opinion php82 dev-feedback  |     Focuses:  coding-
                                            |  standards
--------------------------------------------+------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:60 dmsnell]:
 > > We can't polyfill functions that still exist
 >
 > Why not @swissspidy? since it's part of PHP, am I missing some reason we
 can't check early on for its presence and conditionally include? I would
 expect this to never fail, since it's either there in PHP at bootup or
 it's never going to be otherwise dynamically added.
 >
 > {{{#!php
 > <?php
 > if ( function_exists( 'utf8_encode' ) ) {
 >       require_once __DIR__ . '/wp-includes/utf8_encode_polyfill.php';
 > }
 > }}}

 I think Pascal's point is that this would only work on PHP 9.x when the
 functions are actually removed, whereas:
 > Many WP site will be on PHP 8.2 and below for many years to come,
 continuing to experience these deprecation warnings. We need to address
 this now, not in X years when we raise the minimum PHP version to one
 where the functions were actually removed.

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


More information about the wp-trac mailing list