• Resolved knubew

    (@knubew)


    Hello,

    I’m using Woody ad snippets Version 2.3.1 with WordPress 5.3.2 and PHP 7.2.28.

    Today I saw, that my server “error.log” is messed up with tons of the following PHP warnings. This warnings are created at nearly every page request (backend and frontend).

    [Wed Mar 11 20:37:50.192817 2020] [proxy_fcgi:error] [pid 5427] [client 123.123.123.123:49090] AH01071: Got error 'PHP message: PHP Warning: number_format() expects parameter 1 to be float, string given in /var/www/vhosts/httpdocs/portal/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()'d code on line 45

    Under https://www.php.net/manual/en/function.eval.php I read…

    Caution The eval() language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged. If you have carefully verified that there is no other option than to use this construct, pay special attention not to pass any user provided data into it without properly validating it beforehand.

    Although everything works fine, I want to ask if there is a chance to get rid as well of the PHP warnings as of the use of “eval()” in “/plugins/insert-php/includes/shortcodes/shortcode-php.php(52)”?

    Any help is appreciated. Thank you.

    • This topic was modified 5 years ago by knubew.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Temyk

    (@webtemyk)

    Hello.

    This is a problem in one of your snippets, in the number_format() function. It expects a float number in the first parameter, but passes a string.

    We can’t opt out of the eval() function, since it’s where Woody works.

    Thread Starter knubew

    (@knubew)

    Hello Artem,

    This is a problem in one of your snippets, in the number_format() function. It expects a float number in the first parameter, but passes a string.

    I’m sorry, but I overlooked my own number_format() funtion. Using (float) in front of a string variable (with a price in it) did the trick. No PHP warning are in my error.log file anymore. Thank you very much for the hint.

    We can’t opt out of the eval() function, since it’s where Woody works.

    Ok, I understand.

    Best regards

    • This reply was modified 5 years ago by knubew.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Warning: number_format() expects parameter 1 to be float’ is closed to new replies.