Attempt to read property "subject" on null in ThemeScanner.php:221
Dahfrenk opened this issue · 1 comments
Dahfrenk commented
Hello @daftspunk,
This seems to be the best repo to report this in. After the recent mail template changes required to update to OctoberCMS 3.6 I am running into an issue with this plugin. When I want to scan for new messages (In the backend translation settings) the follow error occurs;
ErrorException: Attempt to read property "subject" on null in .../plugins/rainlab/translate/classes/ThemeScanner.php:221
I have checked the code and found where the error happens;
public function scanMailTemplatesForMessages()
{
$messages = [];
foreach (MailTemplate::allTemplates() as $mailTemplate) {
$messages = array_merge($messages, $this->parseContent($mailTemplate->subject));
$messages = array_merge($messages, $this->parseContent($mailTemplate->content_html));
}
$this->importMessages($messages);
}
As a follow up to this I have printed out what comes out of the MailTemplate::allTemplates() function which is as follows;
So some of the mail templates are null. Is there any way to clean this up?
Edit: I checked the database, and all records there are looking good.
daftspunk commented
This is a bug in the allTemplates
method, should be fixed in v3.6.3