RSS und Atom Feed Reader Online

WordPress Trac: Ticket #61930: size_format(): Inconsistent behaviour when zero bytes are passed

The size_format() function returns false if zero is passed as a string and returns '0 B' if zero is passed as an integer.

The root cause is a strict comparison when checking against zero (if ( 0 === $bytes ) {). If the $bytes parameter is passed as a string ('0'), the condition fails.

Proposed Fix: if ( 0 === $bytes || '0' === $bytes ) {

This behaviour was introduced in WP 4.6.0. Before v4.6.0, both 0 and '0' resulted in size_format() returning false.

version changed

  • version changed from 6.6.1 to 4.6

Hello @marian1,

Welcome to WordPress Core's Trac.

I'm doing triage today for bugs reported on 6.6.1 or 6.6.2 (i.e. via Version) and then updating ticket information.

The strict comparison was introduced in Version 4.6 via #36635 / [37962]. Updating the Version to 4.6.

Veröffentlicht am 16.09.2024 um 20:25:33 Uhr - Kategorie: Ticket - Autor: hellofromTonya

keywords deleted

  • keywords has-patch removed

Hi @marian1

Welcome to the Core Trac!

Thanks for the detailed information.

I have added the patch for the same.

Veröffentlicht am 27.08.2024 um 07:19:18 Uhr - Kategorie: Ticket - Autor: narenin

keywords set

  • keywords has-patch added

This ticket was mentioned in PR #7248 on WordPress/wordpress-develop by @narenin. Trac ticket: https://core.trac.wordpress.org/ticket/61930

Veröffentlicht am 27.08.2024 um 07:18:15 Uhr - Kategorie: Ticket - Autor: prbot



Webhosting bei Alfahosting - jetzt kostenlos testen!