Won't fix Method name \XF\Http\Upload::isValid() is misleading

Kirby

Well-known member
Affected version
2.2.12
Method name XF\Http\Upload::isValid() indicates that the method is "read only" according to \XF\Util\Php::nameIndicatedReadOnly(), but this is not necessarily the case:

If the uploaded file is an image that needs to be rotated / flipped or resized, caling isValid() internally calls transformImage() which in fact does overwrite the original upload, eg. it does modify data.

Could this be changed so calling isValid() does not modify the originally uploaded file but instead creates a new file that will be used afterwards?
 
\XF\Util\Php::nameIndicatesReadOnly() is a primitive heuristic rather than an absolute law. I'm not sure that there's a good reason to change the current behavior and, even if there was, I don't think it's possible to do without mutating the object state (which defeats the point) or requiring changes to all call sites (which breaks backwards compatibility). Unless there's a compelling reason that trumps those concerns?
 
Back
Top Bottom