Make WordPress Core

Opened 6 weeks ago

Last modified 6 weeks ago

#64767 new defect (bug)

Some PHP Warnings appears with PHP 8.5

Reported by: phil78180's profile phil78180 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.9.1
Component: General Keywords: php85 has-patch
Focuses: Cc:

Description

class WP_Translation_File_MO, lines 70 and 75 :

[01-Mar-2026 15:23:31 UTC] PHP Warning: The float 2500072158 is not representable as an int, cast occurred in D:\SITES_WEB\Gexprod\Site\wp-includes\l10n\class-wp-translation-file-mo.php on line 70

[01-Mar-2026 15:23:33 UTC] PHP Warning: The float 2500072158 is not representable as an int, cast occurred in D:\SITES_WEB\Gexprod\Site\wp-includes\l10n\class-wp-translation-file-mo.php on line 75

Attachments (1)

64767.patch (6.6 KB) - added by yasirkhalifa 6 weeks ago.
patch file

Download all attachments as: .zip

Change History (3)

@yasirkhalifa
6 weeks ago

patch file

#1 @yasirkhalifa
6 weeks ago

  • Keywords has-patch added

I18N: Prevent PHP 8.5 float-to-int warnings in WP_Translation_File_MO.

On PHP 8.5+, large unsigned 32-bit integers returned by unpack() may be represented as floats on some platforms. Subsequent implicit casting can trigger warnings such as:

"The float 2500072158 is not representable as an int, cast occurred"

This patch introduces a helper method to normalize unpacked uint32 values and applies it to header and entry offsets before comparisons and arithmetic operations.

This ensures consistent unsigned 32-bit handling and prevents float-to-int casting warnings while maintaining existing behavior on both 32-bit and 64-bit platforms.

#2 @siliconforks
6 weeks ago

Note that 32-bit PHP is not really supported by WordPress any more - there are known serious issues with it like #63099.

Note: See TracTickets for help on using tickets.