If I'm using big values for the maximum limit, I have error on conversion in bytes.
In PHP, on a 32-bit system, the largest value that can be held in an INT is 2147483647. This is equal with 1.999999(and more digits) Gb.
I've tested the setMax with a greater value, like 8000M, but the tests can be made also with 2G.
The function setMax has a casting method to integer
$max = (int) $this->fromByteString($max);
This method will return a negative value because of the cast "(int)".
Example: setMax(7.81 GB) will have calculated max -204010947
The propose is to use "floor" casting like
$max = floor($this->fromByteString($max));
This bug is also presented in ZF3 package.
I'm giving you the example of usage of Size validator, from a getInputFilter() function. The value returned by the below call $this->getUploadMaxFilesize() is "8000M".
If I'm using big values for the maximum limit, I have error on conversion in bytes. In PHP, on a 32-bit system, the largest value that can be held in an INT is 2147483647. This is equal with 1.999999(and more digits) Gb. I've tested the setMax with a greater value, like 8000M, but the tests can be made also with 2G.
The function setMax has a casting method to integer
$max = (int) $this->fromByteString($max);
This method will return a negative value because of the cast "(int)".Example: setMax(7.81 GB) will have calculated max -204010947
The propose is to use "floor" casting like
$max = floor($this->fromByteString($max));
This bug is also presented in ZF3 package.
I'm giving you the example of usage of Size validator, from a getInputFilter() function. The value returned by the below call
$this->getUploadMaxFilesize()
is "8000M".