File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ PHP 8.5 UPGRADE NOTES
142
142
. Using a printf-family function with a formatter that did not specify the
143
143
precision previously incorrectly reset the precision instead of treating
144
144
it as a precision of 0. See GH-18897.
145
+ . Passing 1 as the second argument to log() now throws a ValueError.
146
+ Previously, it returned NaN.
145
147
146
148
========================================
147
149
2. New Features
Original file line number Diff line number Diff line change @@ -667,13 +667,9 @@ PHP_FUNCTION(log)
667
667
RETURN_DOUBLE (log10 (num ));
668
668
}
669
669
670
- if (base == 1.0 ) {
671
- RETURN_DOUBLE (ZEND_NAN );
672
- }
673
-
674
- if (base <= 0.0 ) {
675
- zend_argument_value_error (2 , "must be greater than 0" );
676
- RETURN_THROWS ();
670
+ if (base <= 0.0 || base == 1.0 ) {
671
+ zend_argument_value_error (2 , "must not be 1 or less than or equal to 0" );
672
+ RETURN_THROWS ();
677
673
}
678
674
679
675
RETURN_DOUBLE (log (num ) / log (base ));
Original file line number Diff line number Diff line change 9
9
} catch (ValueError $ exception ) {
10
10
echo $ exception ->getMessage () . "\n" ;
11
11
}
12
+
13
+ try {
14
+ log (36 , 1 );
15
+ } catch (ValueError $ exception ) {
16
+ echo $ exception ->getMessage () . "\n" ;
17
+ }
12
18
?>
13
19
--EXPECT--
14
- log(): Argument #2 ($base) must be greater than 0
20
+ log(): Argument #2 ($base) must not be 1 or less than or equal to 0
21
+ log(): Argument #2 ($base) must not be 1 or less than or equal to 0
You can’t perform that action at this time.
0 commit comments