YetiForceCompany / YetiForceCRM

Our team created for you one of the most innovative CRM systems that supports mainly business processes and allows for customization according to your needs. Be ahead of your competition and implement YetiForce!
https://yetiforce.com
Other
1.68k stars 724 forks source link

[bug] Call to a member function validateAndSecure() on false #17463

Open diderich opened 1 month ago

diderich commented 1 month ago

🐞 bug report

⁉️ Describe the bug

When running the mail scanner (interactively or via cron) and there is an issue with the attachments, the function validateAndSecure() may be called when the object does not exist, i.e. when the creating function in app/Fields/File.php static::loadFromFileor static::loadFromUrl returns false or null.

To correct this, ensure that validateAndSecure() is only called on a proper object, for example by replacing

if($fileInstance->validateAndSecure()) {

with

if($fileInstance !== false && $fileInstance !== null && $fileInstance->validateAndSecure())

🌍 Your Environment

Environment Version / Name
YetiForce 7.0.1
PHP 8.3.7