HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Vanilla 3.3 -- Fatal Error when trying to create or edit Categories

Hi,

I have a fresh Vanilla 3.3 installation. Everything seems to work OK, but when I try to add a new category or edit an existing one (i.e. the default General category), I get the fatal error "Something has gone wrong".

I'm using PHP7.4 now, but the issue was the same with PHP7.2. I can see here that another user has similar issues on a similar configuration. Any help or hints would be very appreciated. Thanks!

Here's the debugging output + system info:

Fatal Error in Twig\ExpressionParser.parsePrimaryExpression();

Unexpected operator of value "=". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.

The error occurred on or near: /var/www/vanilla/applications/vanilla/views/vanillasettings/editcategory.twig

62:     {{ form.imageUploadPreview(
63:         'Photo',
64:         t('Photo'),
65:         '',
66:         category.CategoryID !== null ? 'vanilla/settings/deletecategoryphoto/' ~ category.CategoryID : ''
67:     ) }}
68: 
69:     {#
70:         // Extended fields may be defined through some addon.

Backtrace:

[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:175] Twig\ExpressionParser->parsePrimaryExpression();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:70] Twig\ExpressionParser->getPrimary();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:83] Twig\ExpressionParser->parseExpression();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:593] Twig\ExpressionParser->parseExpression();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:477] Twig\ExpressionParser->parseArguments();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:395] Twig\ExpressionParser->parseSubscriptExpression();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:289] Twig\ExpressionParser->parsePostfixExpression();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:175] Twig\ExpressionParser->parsePrimaryExpression();
[/var/www/vanilla/vendor/twig/twig/src/ExpressionParser.php:70] Twig\ExpressionParser->getPrimary();
[/var/www/vanilla/vendor/twig/twig/src/Parser.php:142] Twig\ExpressionParser->parseExpression();
[/var/www/vanilla/vendor/twig/twig/src/Parser.php:98] Twig\Parser->subparse();
[/var/www/vanilla/vendor/twig/twig/src/Environment.php:563] Twig\Parser->parse();
[/var/www/vanilla/vendor/twig/twig/src/Environment.php:595] Twig\Environment->parse();
[/var/www/vanilla/vendor/twig/twig/src/Environment.php:408] Twig\Environment->compileSource();
[/var/www/vanilla/vendor/twig/twig/src/Environment.php:381] Twig\Environment->loadClass();
[/var/www/vanilla/vendor/twig/twig/src/Environment.php:359] Twig\Environment->loadTemplate();
[/var/www/vanilla/vendor/twig/twig/src/Environment.php:318] Twig\Environment->load();
[/var/www/vanilla/library/Vanilla/Web/TwigRenderTrait.php:67] Twig\Environment->render();
[/var/www/vanilla/library/Vanilla/Web/LegacyTwigViewHandler.php:36] Vanilla\Web\LegacyTwigViewHandler->renderTwig();
[/var/www/vanilla/library/core/class.controller.php:785] Vanilla\Web\LegacyTwigViewHandler->render();
[/var/www/vanilla/library/core/class.controller.php:1386] Gdn_Controller->fetchView();
[/var/www/vanilla/library/core/class.pluggable.php:217] Gdn_Controller->xRender();
[/var/www/vanilla/applications/vanilla/controllers/class.vanillasettingscontroller.php:479] Gdn_Pluggable->__call();
[/var/www/vanilla/library/core/class.dispatcher.php:872] VanillaSettingsController->addCategory();
[/var/www/vanilla/library/core/class.dispatcher.php:289] Gdn_Dispatcher->dispatchController();
[/var/www/vanilla/index.php:29] Gdn_Dispatcher->dispatch();

Additional information for support personnel:

  • Application: Vanilla
  • Application Version: 3.3
  • PHP Version: 7.4.7
  • Operating System: Linux
  • Server Software: Apache/2.4.43 (Ubuntu)
  • Referer: https://forum.xxx.eu/vanilla/settings/categories
  • User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
  • Request Uri: /vanilla/settings/addcategory?parent=
  • Controller: Twig\ExpressionParser
  • Method: parsePrimaryExpression


Comments

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Please have a look if there is also a editcategory.php file in the same folder. If yes, delete the twig file

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    I have reported that some months ago: https://github.com/vanilla/vanilla/issues/10106


    Not sure if it makes sense to use the current editcategory.twig, but that's what would try

  • Options

    @R_J thank you so much for your help! Problem solved.

    I don't have the editcategory.php file, but I replaced line 66 in the editcategory.twig file:

    category.CategoryID !== null ? 'vanilla/settings/deletecategoryphoto/' ~ category.CategoryID : ''

    with this line:

    category.CategoryID is defined ? 'vanilla/settings/deletecategoryphoto/' ~ category.CategoryID : ''

Sign In or Register to comment.