extiverse / bazaar

The extension marketplace for your Flarum forum.
https://discuss.flarum.org/d/5151
MIT License
59 stars 14 forks source link

InvalidArgumentException Cannot identify -1 when memory_limit set to -1 #71

Closed clarkwinkelmann closed 7 years ago

clarkwinkelmann commented 7 years ago

When memory_limit is set to -1, FileSizeHelper::identifySize() fails with exception "Cannot identify -1."

This prevents the admin panel from loading because that check is run at every request.

We need to handle this case without the method failing.

luceos commented 7 years ago

I thought I had considered that, did I miss a location?

https://github.com/flagrow/bazaar/blob/master/src/Listeners/AddApiAttributes.php#L45

clarkwinkelmann commented 7 years ago

You've considered it, but apparently not tested it :stuck_out_tongue_winking_eye:

var_dump(ini_get('memory_limit'));
string(2) "-1"

That strict === check cannot handle it.

(I just checked all this, I didn't notice there was code supposed to handle it during my quick check)

luceos commented 7 years ago

Right that's really stupid, so it should be a string comparison 🤦‍♂️