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 600439b commit 386cbd4Copy full SHA for 386cbd4
ext/standard/math.c
@@ -410,13 +410,15 @@ PHP_FUNCTION(clamp)
410
RETURN_THROWS();
411
}
412
413
- if (zend_compare(zmin, zmax) > 0) {
414
- zend_argument_value_error(2, "must be smaller than or equal to argument #3 ($max)");
415
- RETURN_THROWS();
416
- }
+ if (Z_TYPE_P(zmax) != IS_NULL) {
+ if (zend_compare(zmin, zmax) > 0) {
+ zend_argument_value_error(2, "must be smaller than or equal to argument #3 ($max)");
+ RETURN_THROWS();
417
+ }
418
- if (zend_compare(zmax, zvalue) == -1) {
419
- RETURN_COPY(zmax);
+ if (zend_compare(zmax, zvalue) == -1) {
420
+ RETURN_COPY(zmax);
421
422
423
424
if (zend_compare(zvalue, zmin) == -1) {
0 commit comments