Page MenuHomePhabricator

PHP Deprecated: Implicit conversion from float to int loses precision in maintenance/updateCollation.php on line 458
Closed, ResolvedPublic

Description

Happens when --verbose-stats is used.

Noticed on MW 1.40.2 but it doesn't seem the code has been updated after that.

Event Timeline

Reedy subscribed.
		for ( $coarseIndex = 0; $coarseIndex < $numBins; $coarseIndex++ ) {
			$val = $coarseHistogram[$coarseIndex] ?? 0;
			// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset False positive
			$boundary = $coarseBoundaries[$coarseIndex];
			$this->output( sprintf( "%-10s %-10d |%s\n",
				$prevBoundary . '-' . ( $boundary - 1 ) . ': ',
				$val,
				str_repeat( '*', $scale * $val ) ) );
			$prevBoundary = $boundary;
		}

458 in 1.40 is str_repeat( '*', $scale * $val ) ) );

Which is line 395 in master.

Reedy triaged this task as Low priority.Mar 2 2024, 9:59 PM

Heh, the code is basically unchanged for over a decade since it was added rMW8df24d558639: updateCollation.php size histogram feature

Change 1008056 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@master] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008056

Change 1008056 merged by jenkins-bot:

[mediawiki/core@master] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008056

Change 1008010 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_41] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008010

Change 1008011 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_40] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008011

Change 1008012 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_39] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008012

Reedy claimed this task.

Change 1008010 merged by jenkins-bot:

[mediawiki/core@REL1_41] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008010

Change 1008012 merged by jenkins-bot:

[mediawiki/core@REL1_39] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008012

Change 1008011 merged by jenkins-bot:

[mediawiki/core@REL1_40] updateCollation: Explicitly cast $scale to int

https://gerrit.wikimedia.org/r/1008011