@@ -240,26 +240,41 @@ PHP_METHOD(Random_Randomizer, getFloat)
240
240
RETURN_THROWS ();
241
241
#endif
242
242
243
- if (UNEXPECTED (max < min )) {
244
- zend_argument_value_error (2 , "must be greater than or equal to argument #1 ($min)" );
245
- RETURN_THROWS ();
246
- }
247
-
248
243
if (bounds ) {
249
244
zval * case_name = zend_enum_fetch_case_name (bounds );
250
245
bounds_name = Z_STR_P (case_name );
251
246
}
252
247
253
248
if (zend_string_equals_literal (bounds_name , "ClosedOpen" )) {
249
+ if (UNEXPECTED (max <= min )) {
250
+ zend_argument_value_error (2 , "must be greater than argument #1 ($min)" );
251
+ RETURN_THROWS ();
252
+ }
253
+
254
254
RETURN_DOUBLE (getFloat_closed_open (randomizer -> algo , randomizer -> status , min , max ));
255
255
}
256
256
if (zend_string_equals_literal (bounds_name , "ClosedClosed" )) {
257
+ if (UNEXPECTED (max < min )) {
258
+ zend_argument_value_error (2 , "must be greater than or equal to argument #1 ($min)" );
259
+ RETURN_THROWS ();
260
+ }
261
+
257
262
RETURN_DOUBLE (getFloat_closed_closed (randomizer -> algo , randomizer -> status , min , max ));
258
263
}
259
264
if (zend_string_equals_literal (bounds_name , "OpenClosed" )) {
265
+ if (UNEXPECTED (max <= min )) {
266
+ zend_argument_value_error (2 , "must be greater than argument #1 ($min)" );
267
+ RETURN_THROWS ();
268
+ }
269
+
260
270
RETURN_DOUBLE (getFloat_open_closed (randomizer -> algo , randomizer -> status , min , max ));
261
271
}
262
272
if (zend_string_equals_literal (bounds_name , "OpenOpen" )) {
273
+ if (UNEXPECTED (max <= min )) {
274
+ zend_argument_value_error (2 , "must be greater than argument #1 ($min)" );
275
+ RETURN_THROWS ();
276
+ }
277
+
263
278
RETURN_DOUBLE (getFloat_open_open (randomizer -> algo , randomizer -> status , min , max ));
264
279
}
265
280
ZEND_UNREACHABLE ();
0 commit comments