Skip to content

Unexpected result of gmp_pow with huge exponent #16500

Closed as not planned
Closed as not planned
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
var_dump(gmp_pow("256", PHP_INT_MAX));

Resulted in this output:

object(GMP)#1 (1) {
  ["num"]=>
  string(8) "16777216"
}

But I expected this output instead:

it should alert an overflow?

Or should have a limit for exponent?

PHP Version

nightly

Operating System

ubuntu 22.04

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