Skip to content

Rector fails with "Division by zero" caused by 1/0 #9026

@UweOhse

Description

@UweOhse

Bug Report

Rector 2.0.9:

[ERROR] Could not process "/var/www/nf/beta/test.php" file, due to:
"System error: "Division by zero"
Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On line: 185

Minimal PHP Code Causing Issue

<?php

function test($mode)
{
      // $x = 1 / (intval($mode) - 3);  // this is ok.
      $x = 1 / 0;
}

This is an extract of larger function meant to trigger errors.

using withCodeQualityLevel(99)

https://getrector.com/demo/55fdb056-5406-4fa0-baa4-95881e25a400

Expected Behaviour

I don't know. I'd really prefer if rector left that code alone, may be it could warn about it.

Thank you

Thank you for rector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions