Mautic Community Forums

Mautic 2.0 Preview form error log

So I tried to preview a campaing form on the mautic UI which prompted to a new site with this error logs

Does anyone have the same error?

Warning: include(/home/user/mautic/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php): failed to open stream: No such file or directory in /home/user/mautic/vendor/composer/ClassLoader.php on line 412



Warning: include(): Failed opening ‘/home/user/mautic/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/padron5/mautic/vendor/composer/ClassLoader.php on line 412



Fatal error: Class ‘Twig_Node_Expression_Test_Defined’ not found in /home/user/mautic/app/cache/prod/classes.php on line 6705

This issue was already reported at GitHub. Please, let’s discuss this issue there so it’s all in one place:

https://github.com/mautic/mautic/issues/1983#issuecomment-231334371

Almost same issue here.
Before:

error] 1258#1258: *390 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Twig_Node_Expression_Test_Defined' not found in /var/www/.../htdocs/vendor/twig/twig/lib/Twig/Extension/Core.php on line 298" while reading response header from upstream, client: ..., server: ..., request: "POST /form/submit?formId=2 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: ...

Now:

[error] 1258#1258: *694 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Twig_Node_Expression_Test_Defined' not found in /var/www/.../htdocs/app/cache/prod/classes.php on line 6705" while reading response header from upstream, client: ..., server: ..., request: "POST /form/submit?formId=2 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: ...

Already tried clearing cache…

So I tried to preview a campaing form on the mautic UI which prompted to a new site with this error logs
Does anyone have the same error?
Warning: include(/home/user/mautic/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php): failed to open stream: No such file or directory in /home/user/mautic/vendor/composer/ClassLoader.php on line 412

Warning: include(): Failed opening ‘/home/user/mautic/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/padron5/mautic/vendor/composer/ClassLoader.php on line 412

Fatal error: Class ‘Twig_Node_Expression_Test_Defined’ not found in /home/user/mautic/app/cache/prod/classes.php on line 6705

I have been seeing this error on a few other actions as well. I see it when trying to use the landing page builder and when trying to clear my cache. It also appears several times in my apache logs. I was getting this error when using a custom theme but I fixed a couple of syntax issues and the error went away, no idea what is actually causing it though.

Edit
I have included the message I get when clearing my cache:

[quote]
PHP Warning: include(): Failed opening ‘/var/www/html/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php’ for inclusion (include_path=’.:/usr/share/php’) in /var/www/html/vendor/composer/ClassLoader.php on line 412

[SymfonyComponentDebugExceptionClassNotFoundException]
Attempted to load class “Twig_Node_Expression_Test_Defined” from the global namespace.
Did you forget a “use” statement?[/quote]