Created
August 30, 2019 20:19
-
-
Save 3D-I/d7679f1fb1fa9b6c55d876fa7a9c613b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change get_chunk_size() calculation to correctly calculate limits without | |
* letting a zero "unlimited" value always win. Also ensure get_chunk_size() | |
* can only return zero if all of the limits were in fact set to unlimited. | |
*/ | |
$max = 0; | |
$limits = [100, 200, 300]; | |
foreach ($limits as $limit) | |
{ | |
if ($limit > 0) | |
{ | |
$max = ($max !== 0) ? min($limit, $max) : $limit; | |
} | |
} | |
echo floor($max / 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment