Skip to content

Fix for "Notice: A non well formed numeric value encountered" with v1.6.4 #34

@GuillaumeRossolini

Description

@GuillaumeRossolini

Hi,

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions