From f2151a204724c2b9e4a88df07e35204bab9b727f Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Wed, 18 Aug 2021 20:44:35 +0200
Subject: [PATCH] Pomo/ PHP 8.1: improve the fix for `auto_detect_line_endings`

... as per the inline comment.
---
 src/wp-includes/pomo/po.php | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/wp-includes/pomo/po.php b/src/wp-includes/pomo/po.php
index 22b94c11bf..6e1aca0f75 100644
--- a/src/wp-includes/pomo/po.php
+++ b/src/wp-includes/pomo/po.php
@@ -13,10 +13,15 @@ if ( ! defined( 'PO_MAX_LINE_LEN' ) ) {
 	define( 'PO_MAX_LINE_LEN', 79 );
 }
 
-// This setting has been deprecated in PHP 8.1.
-if ( PHP_VERSION_ID < 80100 ) {
-	ini_set( 'auto_detect_line_endings', 1 );
-}
+/*
+ * The `auto_detect_line_endings` setting has been deprecated in PHP 8.1,
+ * but will continue to work until PHP 9.0.
+ * For now, we're silencing the deprecation notice as there may still be
+ * translation files around which haven't been updated in a long time and
+ * which still use the old MacOS stand-alone `\r` as a line-ending.
+ * This fix should be revisited when PHP 9.0 is in alpha/beta.
+ */
+@ini_set( 'auto_detect_line_endings', 1 );
 
 /**
  * Routines for working with PO files
-- 
2.32.0.windows.2

