Skip to content

Integer arithmethic with large number variants fails #8778

Closed

Description

@cmb69

Description

The following code:

<?php
$int = 0x100000000;
var_dump(
    $int,
    new variant($int) + 1
);

Resulted in this output:

int(4294967296)

Fatal error: Uncaught TypeError: Unsupported operand types: variant + int in %s:%d

But I expected this output instead:

int(4294967296)
int(4294967297)

PHP Version

PHP-8.0

Operating System

Windows x64

Activity

  1. cmb69 commented on Jun 14, 2022

    @cmb69
    MemberAuthor

    Oh, but casting to string would work:

    > php -r "var_dump((string) new variant(0x100000000));"
    string(10) "4294967296"
    
  2. added a commit that references this issue on Jun 14, 2022
    a30772d
  3. self-assigned this
    on Jun 14, 2022
  4. added 2 commits that reference this issue on Jun 18, 2022
    5869e8a
    790be97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions