function exp(float $number): float {}
-function log(float $number, float $base = M_E): float|false {}
+function log(float $number, float $base = M_E): float {}
function log10(float $number): float {}
#define arginfo_exp arginfo_ceil
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_log, 0, 1, MAY_BE_DOUBLE|MAY_BE_FALSE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_log, 0, 1, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, number, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, base, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
}
/* }}} */
-/* {{{ proto float|false log(float number, [float base])
+/* {{{ proto float log(float number, [float base])
Returns the natural logarithm of the number, or the base log if base is specified */
PHP_FUNCTION(log)
{
}
if (base <= 0.0) {
- php_error_docref(NULL, E_WARNING, "base must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("Base must be greater than 0");
+ return;
}
RETURN_DOUBLE(log(num) / log(base));
precision=14
--FILE--
<?php
-log(36, -4);
+try {
+ log(36, -4);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: log(): base must be greater than 0 in %s on line %d
+--EXPECT--
+Base must be greater than 0