ryancramerdesign / ProcessWire

Our repository has moved to https://github.com/processwire – please head there for the latest version.
https://processwire.com
Other
727 stars 198 forks source link

PHP Notice: A non well formed numeric value encountered in .../Inputfield/InputfieldFile/InputfieldFile.module:124 #2022

Closed adrianbj closed 8 years ago

adrianbj commented 8 years ago

I just set up a php 7 testing environment and noticed this. It is because $filesize returns "8M" so on line 124 you have this:

else if($last == 'm') $this->maxFilesize = ($filesize*1024)*1024;

which obviously won't work as expected. screen shot 2016-09-05 at 6 30 41 pm

Note that the line numbers have changed by one because I inserted the Tracy bd() call to find out what $filesize was returning.

adrianbj commented 8 years ago

As a bit of an aside - should the init() be called twice like it is? I am noticing that all over the place, but maybe that is expected.

Nevermind - there were two image fields on the page :)

ryancramerdesign commented 8 years ago

Thanks Adrian, I've pushed a fix for this. I have a feeling there will be more of those notices as I've never been shy about using PHP's auto int casting via math operators, but apparently they throw notices for that now.

adrianbj commented 8 years ago

Thanks Ryan - I never actually knew that PHP auto casted via math operators - learn something new every day, although apparently I should forget this pretty quickly :)