Solving PHP Notice: A non well formed numeric value

Feb 112018
 
 Posted by on 11/02/2018 How-To's Tagged with: ,  Add comments

The comment from OpaJaap to my article https://drafie-design.nl/set-suffusion-to-be-responsive/ was inspired me and woke me up to look again at codes.

If you don’t know who is Jacob N. Breetvelt aka OpaJaap, take a look at his brilliant plugin: WP Photo Album Plus. For old users who’s remembers and liked the functionality of PhotoSmash Galleries, the plugin of OpaJaap is the best solution for trying to. The plugin have literally hundreds of options and can be settled in each detail to obtain exactly the look and feel you need. The options are full documented at WPPA site, but also OpaJaap actively support it on WordPress forums.

For me, this guy is a legend, so, you can understand for what I tried immediately to solve the problems reported in his comment.

He said:

“I run php 7.2 and get a lot of errors like:
Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Widgets has a deprecated constructor in …/wp-content/themes/suffusion/widgets/suffusion-widgets.php on line 10
and al lot of non-welformed numbers.”

I solved the problem of constructor methods last night and I published the results in my post: Solving the warnings generated by Suffusion on servers with PHP 7+

But I couldn’t see the problem with the numbers until now. As I told to OpaJaap in my reply, I always set “Auto-generate the CSS and print it in the HTML source (Least load on server, ugly page source code)” at the first option from Suffusion Options -> Back-end -> Site Optimization. By settling this, the warnings are avoided, no problem with numbers.

But on a new installation or on sites where that option remain default to “Auto-generate the CSS and link it as a file (Low load on server, elegant page source code)”, will observe in debug.log 3 notices like:

PHP Notice: A non well formed numeric value encountered in …../wp-content/themes/suffusion/suffusion-css-helper.php on line 426

OpaJaap was very kind and sent the explanation for warning and the fixes. They are quoted below:

– wp-content/themes/suffusion/suffusion-css-helper.php on line 426:
should read:

The error comes when $widths[‘main-col’] contains e.g. ‘100%’ . One can not substract 30 from 100%

Same cause in /wp-content/themes/suffusion/suffusion-css-generator.php on line 419 and 420 (version 4.5.0, in 4.4.9: lines 403 and 404):
They should read:

I made all changes in files and I assembled a new version of theme, thinking that will be easier for users to upgrade this way instead of replacing particular files.

Enjoy:  Suffusion 4.5.1

https://drafie-design.nl/solving-php-notice-a-non-well-formed-numeric-value/trackback/Trackback URI:  

Ciprian

Experienced web developer and graphic designer. Former consultant for Suffusion theme and former moderator on Suffusion Support forum. I teach others while learning myself.

Google+ Profile

    Google+ Page

 Leave a Reply

(Your comment will be published. To contact me privately, use the contact form.)

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  2 Responses to “Solving PHP Notice: A non well formed numeric value”

Comments (2)
  1. Thank you Andyt,

    The solution from this post was coming from OpaJaap 🙂
    And OpaJaap has become a good friend of Suffusion, helping us when he see problems.
    We will try to keep the Suffusion alive as long as we can.
    For now the theme is compatible with latest PHP, WordPress or anything 🙂

    Thanks,
    Ciprian

     
  2. Thanks for your work about Suffusion 4.5.1 🙂