Changeset 62093 for trunk/src/wp-includes/pomo/po.php
- Timestamp:
- 03/23/2026 02:54:20 PM (4 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/pomo/po.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pomo/po.php
r61444 r62093 13 13 define( 'PO_MAX_LINE_LEN', 79 ); 14 14 } 15 16 /*17 * The `auto_detect_line_endings` setting has been deprecated in PHP 8.1,18 * but will continue to work until PHP 9.0.19 * For now, we're silencing the deprecation notice as there may still be20 * translation files around which haven't been updated in a long time and21 * which still use the old MacOS standalone `\r` as a line ending.22 * This fix should be revisited when PHP 9.0 is in alpha/beta.23 */24 @ini_set( 'auto_detect_line_endings', 1 ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged25 15 26 16 /** … … 476 466 return true; 477 467 } 478 $line = $use_last_line ? $last_line : fgets( $f ); 479 $line = ( "\r\n" === substr( $line, -2 ) ) ? rtrim( $line, "\r\n" ) . "\n" : $line; 468 469 if ( $use_last_line ) { 470 $line = $last_line; 471 } else { 472 $line = fgets( $f ); 473 if ( false === $line ) { 474 return $line; 475 } 476 477 // Handle \r-only terminated lines after the deprecation of auto_detect_line_endings in PHP 8.1. 478 $r = strpos( $line, "\r" ); 479 if ( false !== $r ) { 480 if ( strlen( $line ) === $r + 1 481 && "\r\n" === substr( $line, $r ) 482 ) { 483 $line = rtrim( $line, "\r\n" ) . "\n"; 484 } else { 485 // The lines are terminated by just \r, so we end the line there and rewind. 486 $rewind = strlen( $line ) - $r - 1; 487 $line = substr( $line, 0, $r ) . "\n"; 488 fseek( $f, - $rewind, SEEK_CUR ); 489 } 490 } 491 } 492 480 493 $last_line = $line; 481 494 $use_last_line = false;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)