I'm checking how much memory PHP has free to use, before further execution:
Code: Select all
ini_get('memory limit')
Before PHP7 (7.3?), php would just use that string as-is, ignore the non-numeric part, when used in a calculation.
This seems to have changed and now I get the following warning:
PHP Notice: A non well formed numeric value encountered in /opt/dva-profession/devel/trunk/bin/include/ArchiveStructure.php on line 2372
[SOLUTION]
There's an example for converting a php.ini value like this to a number in PHP docs for "ini_get()", but It seems to suffer from the same new PHP7 stricter-ness
![Very Happy :D](./images/smilies/icon_biggrin.gif)
So I've changed the first lines to this:
Code: Select all
$val = trim(strtolower($val));
$last = $val[strlen($val)-1];
$val = rtrim($val, "gmk");
Now it works without warnings:
Code: Select all
/**
* Converts a PHP config value data size with a modifier character to a
* numeric byte value.
*
* Code is an exact copy from:
* https://www.php.net/manual/en/function.ini-get.php
*/
public static function return_bytes($val) {
$val = trim(strtolower($val));
$last = $val[strlen($val)-1];
$val = rtrim($val, "gmk");
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}