diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 8592d7c0b8810..e85d831e3aed3 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -3136,7 +3136,7 @@ function intdiv(int $num1, int $num2): int {} function is_infinite(float $num): bool {} /** @compile-time-eval */ -function pow(mixed $num, mixed $exponent): int|float|object {} +function pow(int|float $num, int|float $exponent): int|float {} /** @compile-time-eval */ function exp(float $num): float {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 48202e78079ac..480d7db0a0c86 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c9edbe45bb7a2b00b413fb3c56683bb8377a725f */ + * Stub hash: 7e052bb5e4e5055b45688555ded0fd02f11cb1f9 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -1663,9 +1663,9 @@ ZEND_END_ARG_INFO() #define arginfo_is_infinite arginfo_is_finite -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pow, 0, 2, MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_OBJECT) - ZEND_ARG_TYPE_INFO(0, num, IS_MIXED, 0) - ZEND_ARG_TYPE_INFO(0, exponent, IS_MIXED, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pow, 0, 2, MAY_BE_LONG|MAY_BE_DOUBLE) + ZEND_ARG_TYPE_MASK(0, num, MAY_BE_LONG|MAY_BE_DOUBLE, NULL) + ZEND_ARG_TYPE_MASK(0, exponent, MAY_BE_LONG|MAY_BE_DOUBLE, NULL) ZEND_END_ARG_INFO() #define arginfo_exp arginfo_sin diff --git a/ext/standard/math.c b/ext/standard/math.c index 377c573033f69..9e6d497412d23 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -570,8 +570,8 @@ PHP_FUNCTION(pow) zval *zbase, *zexp; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ZVAL(zbase) - Z_PARAM_ZVAL(zexp) + Z_PARAM_NUMBER(zbase) + Z_PARAM_NUMBER(zexp) ZEND_PARSE_PARAMETERS_END(); pow_function(return_value, zbase, zexp); diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt index a4283a4ac9464..52a40ff0d8af5 100644 --- a/ext/standard/tests/math/pow_variation1.phpt +++ b/ext/standard/tests/math/pow_variation1.phpt @@ -123,9 +123,13 @@ float(1.881676371789%dE-27) float(0.125) -- Iteration 11 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d int(0) -- Iteration 12 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d int(0) -- Iteration 13 -- @@ -141,31 +145,35 @@ int(1) int(0) -- Iteration 17 -- -Unsupported operand types: string ** int +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 18 -- -Unsupported operand types: string ** int +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 19 -- -Unsupported operand types: array ** int +pow(): Argument #2 ($exponent) must be of type int|float, array given -- Iteration 20 -- -Unsupported operand types: string ** int +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 21 -- -Unsupported operand types: string ** int +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 22 -- -Unsupported operand types: string ** int +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 23 -- -Unsupported operand types: classA ** int +pow(): Argument #2 ($exponent) must be of type int|float, classA given -- Iteration 24 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d int(0) -- Iteration 25 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d int(0) -- Iteration 26 -- -Unsupported operand types: resource ** int +pow(): Argument #2 ($exponent) must be of type int|float, resource given diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt index 5869e905f067c..a4662ed1ab47e 100644 --- a/ext/standard/tests/math/pow_variation1_64bit.phpt +++ b/ext/standard/tests/math/pow_variation1_64bit.phpt @@ -89,7 +89,7 @@ foreach($inputs as $input) { }; fclose($fp); ?> ---EXPECT-- +--EXPECTF-- *** Testing pow() : usage variations *** -- Iteration 1 -- @@ -123,9 +123,13 @@ float(1.8816763717891545E-27) float(0.125) -- Iteration 11 -- + +Deprecated: pow(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 12 -- + +Deprecated: pow(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 13 -- @@ -141,31 +145,35 @@ int(1) int(0) -- Iteration 17 -- -Unsupported operand types: string ** int +pow(): Argument #1 ($num) must be of type int|float, string given -- Iteration 18 -- -Unsupported operand types: string ** int +pow(): Argument #1 ($num) must be of type int|float, string given -- Iteration 19 -- -Unsupported operand types: array ** int +pow(): Argument #1 ($num) must be of type int|float, array given -- Iteration 20 -- -Unsupported operand types: string ** int +pow(): Argument #1 ($num) must be of type int|float, string given -- Iteration 21 -- -Unsupported operand types: string ** int +pow(): Argument #1 ($num) must be of type int|float, string given -- Iteration 22 -- -Unsupported operand types: string ** int +pow(): Argument #1 ($num) must be of type int|float, string given -- Iteration 23 -- -Unsupported operand types: classA ** int +pow(): Argument #1 ($num) must be of type int|float, classA given -- Iteration 24 -- + +Deprecated: pow(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 25 -- + +Deprecated: pow(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 26 -- -Unsupported operand types: resource ** int +pow(): Argument #1 ($num) must be of type int|float, resource given diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt index 9351dbd4ce738..9b7c9d9376764 100644 --- a/ext/standard/tests/math/pow_variation2.phpt +++ b/ext/standard/tests/math/pow_variation2.phpt @@ -85,7 +85,7 @@ foreach($inputs as $input) { }; fclose($fp); ?> ---EXPECT-- +--EXPECTF-- *** Testing pow() : usage variations *** -- Iteration 1 -- @@ -119,9 +119,13 @@ float(1.0000000037168) float(4.5055521304275) -- Iteration 11 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d float(1) -- Iteration 12 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d float(1) -- Iteration 13 -- @@ -137,31 +141,35 @@ float(20.3) float(1) -- Iteration 17 -- -Unsupported operand types: float ** string +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 18 -- -Unsupported operand types: float ** string +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 19 -- -Unsupported operand types: float ** array +pow(): Argument #2 ($exponent) must be of type int|float, array given -- Iteration 20 -- -Unsupported operand types: float ** string +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 21 -- -Unsupported operand types: float ** string +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 22 -- -Unsupported operand types: float ** string +pow(): Argument #2 ($exponent) must be of type int|float, string given -- Iteration 23 -- -Unsupported operand types: float ** classA +pow(): Argument #2 ($exponent) must be of type int|float, classA given -- Iteration 24 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d float(1) -- Iteration 25 -- + +Deprecated: pow(): Passing null to parameter #2 ($exponent) of type int|float is deprecated in %s on line %d float(1) -- Iteration 26 -- -Unsupported operand types: float ** resource +pow(): Argument #2 ($exponent) must be of type int|float, resource given