SIGN IN SIGN UP

Code Modernization: Replace the deprecated `auto_detect_line_endings` setting.

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.

Reference: [https://wiki.php.net/rfc/deprecations_php_8_1#auto_detect_line_endings_ini_setting 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 commits adds code to replace the deprecated setting and still handle old-style `\r` line-terminated files in `PO::read_line()` using `strpos()` + `fseek()`. Includes a unit test covering `\r`, `\n`, and `\r\n` line endings.

Follow-up to [51633], [51636].

Props akirk, apermo, westonruter, SergeyBiryukov.
Fixes #64928.

git-svn-id: https://develop.svn.wordpress.org/trunk@62093 602fd350-edb4-49c9-b593-d223f7449a82
S
Sergey Biryukov committed
e40e13bc843c88f3a4696417feaa93963ef32cdb
Parent: 9a03e90