Skip to content

[Issue] Avoid divide-by-zero fatal error #37804

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #37479: Avoid divide-by-zero fatal error


Description

While working on Ethan3600/magento2-CronjobManager#122, I noticed that providing asking Magento to validate a cron expression which contains /0 resulted in a Fatal error, rather than an exception which I could catch. This pull request fixes the divide-by-zero bug and instead produces a sensible exception. Includes unit test.

Manual testing scenarios

  1. Call \Magento\Cron\Model\Schedule::matchCronExpression('0/0', 0)

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Area: Other Developer ToolsIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions