[wp-trac] [WordPress Trac] #53635: PHP 8.1: various compatibility fixes

WordPress Trac noreply at wordpress.org
Wed Aug 18 13:22:16 UTC 2021

#53635: PHP 8.1: various compatibility fixes
 Reporter:  SergeyBiryukov                       |       Owner:
                                                 |  hellofromTonya
     Type:  task (blessed)                       |      Status:  accepted
 Priority:  normal                               |   Milestone:  5.9
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  php81 has-patch has-unit-tests       |     Focuses:  coding-
  commit                                         |  standards

Comment (by SergeyBiryukov):

 In [changeset:"51633" 51633]:
 #!CommitTicketReference repository="" revision="51633"
 Code Modernization: Only set `auto_detect_line_endings` in PHP < 8.1.

 Since PHP 8.1, the `auto_detect_line_endings` setting is deprecated:

 > The `auto_detect_line_endings` ini setting modifies the behavior of
 `file()` and `fgets()` to support an isolated `\r` (as opposed to `\n` or
 `\r\n`) as a newline character. These newlines were used by “Classic” Mac
 OS, a system which has been discontinued in 2001, nearly two decades ago.
 Interoperability with such systems is no longer relevant.

 PHP RFC: Deprecations for PHP 8.1: auto_detect_line_endings ini setting]

 > The `auto_detect_line_endings` ini setting has been deprecated. If
 necessary, handle `\r` line breaks manually instead.

 Reference: [https://github.com/php/php-
 src/blob/1cf4fb739f7a4fa8404a4c0958f13d04eae519d4/UPGRADING#L456-L457 PHP
 8.1 Upgrade Notes].

 This commit fixes the warning when running tests for the `PO` class:
 Deprecated: auto_detect_line_endings is deprecated in /var/www/src/wp-
 includes/pomo/po.php on line 16

 Follow-up to [10584], [51628].

 See #53635.

Ticket URL: <https://core.trac.wordpress.org/ticket/53635#comment:56>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list