Skip to content

[4.x]: DivisionByZeroError in UpdateElementSlugsAndUris job #16787

@joostwaaijer

Description

@joostwaaijer

What happened?

Description

We are experiencing an issue in one of our site where the UpdateElementSlugsAndUris is reporting a DivisionByZeroError. The issue is happening on this line:
$this->setProgress($queue, $this->_totalProcessed++ / $this->_totalToProcess);

Looks like $this->_totalToProcess can sometimes be 0 while in the foreach (Db::each($query) as $element) { loop

Steps to reproduce

  1. Run the UpdateElementSlugsAndUris job
  2. Randomly it can crash by a DivisionByZeroError

Craft CMS version

4.13.8

PHP version

8.3.16

Operating system and version

No response

Database type and version

PostgreSQL 16.6

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions