You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case anyone still uses this plugin, you will find below a fix for this error:
Notice: A non well formed numeric value encountered
Basically, the issue is that the plugin uses the same value both as an integer for substractions, and as a human-readable mark. that makes PHP v7.1+ show a Notice.
There are two places to fix in the Controller/Plugin/Debug/Plugin/Log.php file:
L120 should read: $this->_marks[$name]['time'] = round((microtime(true)-$_SERVER['REQUEST_TIME'])*1000-(int)$this->_marks[$name]['time']).'ms';
L122 should read: $this->_marks[$name]['memory'] = round((memory_get_usage()-(int)$this->_marks[$name]['memory'])/1024) . 'K';
This is admettedly an ugly fix. A better way could be to parse the value, preg_match it or even split the value in two, one for each purpose (calc or display).
The text was updated successfully, but these errors were encountered:
As a temporary fix, I've created a script executed after any composer install or composer update:
// file path: scripts/fix_zfdebug.php/** * ZFDebug fix for PHP >= 7.1 compatibility * * @author Francesco Zanoni * @version 2019-12-15 */$libraryPath = __DIR__ . "/../vendor/jokkedk/zfdebug/library";
// Exception: count(): Parameter must be an array or an object that implements Countable// jokkedk/zfdebug/library/ZFDebug/Controller/Plugin/Debug/Plugin/Database.php on line 51$filePath = $libraryPath . "/ZFDebug/Controller/Plugin/Debug/Plugin/Database.php";
file_put_contents(
$filePath,
str_replace(
'!count(',
'empty(',
file_get_contents($filePath)
)
);
// Notice: A non well formed numeric value encountered// jokkedk/zfdebug/library/ZFDebug/Controller/Plugin/Debug/Plugin/Log.php on line 119$filePath = $libraryPath . "/ZFDebug/Controller/Plugin/Debug/Plugin/Log.php";
file_put_contents(
$filePath,
str_replace(
'-$this->marks[$name][\'time\']',
'-floatval($this->marks[$name][\'time\'])',
file_get_contents($filePath)
)
);
// Notice: A non well formed numeric value encountered// jokkedk/zfdebug/library/ZFDebug/Controller/Plugin/Debug/Plugin/Log.php on line 121$filePath = $libraryPath . "/ZFDebug/Controller/Plugin/Debug/Plugin/Log.php";
file_put_contents(
$filePath,
str_replace(
'-$this->marks[$name][\'memory\']',
'-intval($this->marks[$name][\'memory\'])',
file_get_contents($filePath)
)
);
Hi,
In case anyone still uses this plugin, you will find below a fix for this error:
Basically, the issue is that the plugin uses the same value both as an integer for substractions, and as a human-readable mark. that makes PHP v7.1+ show a Notice.
There are two places to fix in the
Controller/Plugin/Debug/Plugin/Log.php
file:L120 should read:
$this->_marks[$name]['time'] = round((microtime(true)-$_SERVER['REQUEST_TIME'])*1000-(int)$this->_marks[$name]['time']).'ms';
L122 should read:
$this->_marks[$name]['memory'] = round((memory_get_usage()-(int)$this->_marks[$name]['memory'])/1024) . 'K';
This is admettedly an ugly fix. A better way could be to parse the value, preg_match it or even split the value in two, one for each purpose (calc or display).
The text was updated successfully, but these errors were encountered: