Skip to content

Regression in unpack for minimal int value #7899

Closed

Description

@remicollet

Description

The following code:

<?php
var_dump($a=-2147483648, bin2hex($b=pack("i",  $a)), unpack("i", $b));

Resulted in this output:

  int(2147483648)

But I expected this output instead:

  int(-2147483648)

See https://3v4l.org/3pTU9 and efe79e0

PHP Version

8.1.2RC1

Operating System

irrevelant

Activity

  1. added 3 commits that reference this issue on Jan 13, 2022
    d5b6c0d
    e31c54d
    9406198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions