Skip to content

chr(-1) on ChrArgModuloRector produce invalid code #9972

Closed
rectorphp/rector-src
#8963

Description

@samsonasik

Bug Report

Subject Details
Rector version dev-main

Minimal PHP Code Causing Issue

Given the following code:

chr(-1 % 256);

It make change:

-chr(-1);
+chr(-1 % 256)

which got error:

Deprecated: chr(): Providing a value not in-between 0 and 255 is deprecated, this is because a byte value must be in the [0, 255] interval. The value used will be constrained using % 256 in /in/6W3SR on line 3

Expected Behaviour

-chr(-1);
+chr(-1 % 256 + 256)

Activity

  1. samsonasik commented on Nov 17, 2026

    @samsonasik
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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