Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to upload on php7.1 due to notice #112

Closed
is3kk opened this issue Dec 1, 2017 · 3 comments
Closed

unable to upload on php7.1 due to notice #112

is3kk opened this issue Dec 1, 2017 · 3 comments
Labels

Comments

@is3kk
Copy link

is3kk commented Dec 1, 2017

Hello,

I was unable to complete upload of an image when using sonata-admin on php7.1 . Problem i found was

Notice: A non well formed numeric value encountered
in vendor/comur/image-bundle/Comur/ImageBundle/Handler/UploadHandler.php at line 344

i fixed it by adding a line
$val = substr($val, 0, -1);

inside this function
`
function get_config_bytes($val) {

$val = trim($val);

$last = strtolower($val[strlen($val)-1]);

$val =  substr($val, 0, -1);

switch($last) {

    case 'g':

        $val *= 1024;

    case 'm':

        $val *= 1024;

    case 'k':

        $val *= 1024;

}
return $this->fix_integer_overflow($val);

}
`

and it works fine after this.. BTW i think it should be like 1024*1024 in case of Mb an so on, but nwm..

So maybe it helps someone else.

@DeepSnowNeeL
Copy link

I have the same problem, and fixed it the same way..

@comur
Copy link
Owner

comur commented Jul 19, 2018

Hi,
Thanks for this workaround, maybe you can create a PR with a retrocompatible code ?
Thanks

@comur comur added the bug label May 23, 2019
@comur
Copy link
Owner

comur commented May 31, 2019

This is a bug introduced with one of the PR changing:

$val = (int)$val*1024;

to

$val *= 1024;

It's not merged on latest releases so I close it

@comur comur closed this as completed May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants