Skip to content

Error refactoring ereg_replace to preg_replace #7217

@ThibaultAndreis

Description

@ThibaultAndreis

Bug Report

Subject Details
Rector version v0.13.2

When i try to refactor this line
$telephone = trim(ereg_replace("[^0-9.-]", " ", $address->getTelephone()));

Ii got an error "System error: ""[" does not have a matching "]""

I think the probleme come from the function processSquareBracket from Rector\Php70\Rector\FuncCall\EregToPregMatchRector

there is a ++$i; at line 222 wich, i think, shouldn't be there.

Minimal PHP Code Causing Issue

https://getrector.org/demo/fffc2d64-147e-41c6-b8d4-2b9fdacacd26

Expected Behaviour

I shoudln't get an error

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