diff --git a/src/wp-includes/pomo/entry.php b/src/wp-includes/pomo/entry.php index a750a944a9..b5e56ff28a 100644 --- a/src/wp-includes/pomo/entry.php +++ b/src/wp-includes/pomo/entry.php @@ -81,7 +81,7 @@ if ( ! class_exists( 'Translation_Entry', false ) ) : } // Prepend context and EOT, like in MO files - $key = ! $this->context ? $this->singular : $this->context . chr( 4 ) . $this->singular; + $key = ! $this->context ? $this->singular : $this->context . "\4" . $this->singular; // Standardize on \n line endings $key = str_replace( array( "\r\n", "\r" ), "\n", $key ); diff --git a/src/wp-includes/pomo/mo.php b/src/wp-includes/pomo/mo.php index 44d8cdfc87..25b9e37a9f 100644 --- a/src/wp-includes/pomo/mo.php +++ b/src/wp-includes/pomo/mo.php @@ -124,12 +124,12 @@ if ( ! class_exists( 'MO', false ) ) : // headers' msgid is an empty string fwrite( $fh, pack( 'VV', 0, $current_addr ) ); $current_addr++; - $originals_table = chr( 0 ); + $originals_table = "\0"; $reader = new POMO_Reader(); foreach ( $entries as $entry ) { - $originals_table .= $this->export_original( $entry ) . chr( 0 ); + $originals_table .= $this->export_original( $entry ) . "\0"; $length = $reader->strlen( $this->export_original( $entry ) ); fwrite( $fh, pack( 'VV', $length, $current_addr ) ); $current_addr += $length + 1; // account for the NULL byte after @@ -138,10 +138,10 @@ if ( ! class_exists( 'MO', false ) ) : $exported_headers = $this->export_headers(); fwrite( $fh, pack( 'VV', $reader->strlen( $exported_headers ), $current_addr ) ); $current_addr += strlen( $exported_headers ) + 1; - $translations_table = $exported_headers . chr( 0 ); + $translations_table = $exported_headers . "\0"; foreach ( $entries as $entry ) { - $translations_table .= $this->export_translations( $entry ) . chr( 0 ); + $translations_table .= $this->export_translations( $entry ) . "\0"; $length = $reader->strlen( $this->export_translations( $entry ) ); fwrite( $fh, pack( 'VV', $length, $current_addr ) ); $current_addr += $length + 1; @@ -160,10 +160,10 @@ if ( ! class_exists( 'MO', false ) ) : //TODO: warnings for control characters $exported = $entry->singular; if ( $entry->is_plural ) { - $exported .= chr( 0 ) . $entry->plural; + $exported .= "\0" . $entry->plural; } if ( $entry->context ) { - $exported = $entry->context . chr( 4 ) . $exported; + $exported = $entry->context . "\4" . $exported; } return $exported; } @@ -174,7 +174,7 @@ if ( ! class_exists( 'MO', false ) ) : */ function export_translations( $entry ) { //TODO: warnings for control characters - return $entry->is_plural ? implode( chr( 0 ), $entry->translations ) : $entry->translations[0]; + return $entry->is_plural ? implode( "\0", $entry->translations ) : $entry->translations[0]; } /** @@ -310,21 +310,21 @@ if ( ! class_exists( 'MO', false ) ) : */ function &make_entry( $original, $translation ) { $entry = new Translation_Entry(); - // look for context - $parts = explode( chr( 4 ), $original ); + // Look for context, separated by \4. + $parts = explode( "\4", $original ); if ( isset( $parts[1] ) ) { $original = $parts[1]; $entry->context = $parts[0]; } // look for plural original - $parts = explode( chr( 0 ), $original ); + $parts = explode( "\0", $original ); $entry->singular = $parts[0]; if ( isset( $parts[1] ) ) { $entry->is_plural = true; $entry->plural = $parts[1]; } // plural translations are also separated by \0 - $entry->translations = explode( chr( 0 ), $translation ); + $entry->translations = explode( "\0", $translation ); return $entry; }