We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ea1db9 commit 3450a45Copy full SHA for 3450a45
ext/standard/math.c
@@ -447,13 +447,15 @@ ZEND_FRAMELESS_FUNCTION(clamp, 3)
447
RETURN_THROWS();
448
}
449
450
- if (zend_compare(zmin, zmax) > 0) {
451
- zend_argument_value_error(2, "must be smaller than or equal to argument #3 ($max)");
452
- RETURN_THROWS();
453
- }
+ if (zmax != NULL) {
+ if (zend_compare(zmin, zmax) > 0) {
+ zend_argument_value_error(2, "must be smaller than or equal to argument #3 ($max)");
+ RETURN_THROWS();
454
+ }
455
- if (zend_compare(zmax, zvalue) == -1) {
456
- RETURN_COPY(zmax);
+ if (zend_compare(zmax, zvalue) == -1) {
457
+ RETURN_COPY(zmax);
458
459
460
461
if (zend_compare(zvalue, zmin) == -1) {
0 commit comments