mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4'
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
gmp_pow() basic tests
|
||||
--EXTENSIONS--
|
||||
gmp
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
--TEST--
|
||||
gmp_pow() basic tests
|
||||
--EXTENSIONS--
|
||||
gmp
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_strval(gmp_pow(2,10)));
|
||||
var_dump(gmp_strval(gmp_pow(-2,10)));
|
||||
var_dump(gmp_strval(gmp_pow(-2,11)));
|
||||
var_dump(gmp_strval(gmp_pow("2",10)));
|
||||
var_dump(gmp_strval(gmp_pow("2",0)));
|
||||
try {
|
||||
gmp_pow("2", -1);
|
||||
} catch (ValueError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
var_dump(gmp_strval(gmp_pow("-2",10)));
|
||||
try {
|
||||
gmp_pow(20,10);
|
||||
} catch (ValueError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
try {
|
||||
gmp_pow(50,10);
|
||||
} catch (ValueError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
try {
|
||||
gmp_pow(50,-5);
|
||||
} catch (ValueError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
try {
|
||||
$n = gmp_init("20");
|
||||
gmp_pow($n,10);
|
||||
} catch (ValueError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
try {
|
||||
$n = gmp_init("-20");
|
||||
gmp_pow($n,10);
|
||||
} catch (ValueError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
try {
|
||||
var_dump(gmp_pow(2,array()));
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
var_dump(gmp_pow(array(),10));
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "1024"
|
||||
string(4) "1024"
|
||||
string(5) "-2048"
|
||||
string(4) "1024"
|
||||
string(1) "1"
|
||||
gmp_pow(): Argument #2 ($exponent) must be greater than or equal to 0
|
||||
string(4) "1024"
|
||||
base and exponent overflow
|
||||
base and exponent overflow
|
||||
gmp_pow(): Argument #2 ($exponent) must be greater than or equal to 0
|
||||
base and exponent overflow
|
||||
base and exponent overflow
|
||||
gmp_pow(): Argument #2 ($exponent) must be of type int, array given
|
||||
gmp_pow(): Argument #1 ($num) must be of type GMP|string|int, array given
|
||||
Done
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
gmp_pow() floating point exception
|
||||
--EXTENSIONS--
|
||||
gmp
|
||||
--FILE--
|
||||
<?php
|
||||
$g = gmp_init(256);
|
||||
|
||||
try {
|
||||
gmp_pow($g, PHP_INT_MAX);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
try {
|
||||
gmp_pow(256, PHP_INT_MAX);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
gmp_pow(gmp_add(gmp_mul(gmp_init(PHP_INT_MAX), gmp_init(PHP_INT_MAX)), 3), 256);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
try {
|
||||
gmp_pow(gmp_init(PHP_INT_MAX), 256);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
base and exponent overflow
|
||||
base and exponent overflow
|
||||
base and exponent overflow
|
||||
base and exponent overflow
|
||||
Reference in New Issue
Block a user