Search code examples
laravellaravel-6thephpleague

Laravel can't see existing vendor class after update


I am no longer able to send email from my Laravel app once I updated to v6.10, 6.11. I have not changed any code, nor have I required or removed anything new from composer recently. This appears to be potentially something with the new build of Laravel, as this exact code is functional and sending email on v6.7 and below.

Error msg:

Class 'League\CommonMark\Environment' not found (View: /home/ww/app/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php)

{"exception":"[object] (Facade\Ignition\Exceptions\ViewException(code: 0): Class 'League\CommonMark\Environment' not found (View: /home/ww/app/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php) at /home/videocyp/app/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php:103)

The line from my footer from my published vendor file that is causing the issue:

{{ Illuminate\Mail\Markdown::parse($slot) }}

Inside the vendor file Markdown.php

use League\CommonMark\Environment;

 class Markdown
 { 
    public static function parse($text)
    {
       $environment = Environment::createCommonMarkEnvironment();
       // etc...
 }

Looking at League\CommonMark\Environment, I find the class (as does my IDE):

final class Environment implements EnvironmentInterface, ConfigurableEnvironmentInterface { }

I'm beyond my level of understanding here as to why Laravel is unable to see one of its vendor classes.

Anyone able to help?


Solution

  • Turns out this is the result of a significant (slightly breaking) change made to the Laravel build as of v6.10.

    Due to a potential XSS vulnerability, it looks like they changed the root parser to League CommonMark. This is causing other issues with existing email published templates due to excess white space being parsed differently in the new CommonMark parser. Bugs are reported here, here, here.

    My particular problem was extremely strange, but it is being reported elsewhere in addition to those reported back to Laravel. It was not consistent across my servers, but a complete rebuild (vagrant) solved the issue.

    For the others with their previously published email templates showing raw HTML, a re-publish may resolve the issue if lucky and no changes were made to the templates.