1

I've successfully upgraded a Craft 2 install to Craft 3 on my local machine, but now that I've moved everything to production, I'm getting this error anytime I try to load a template that uses Freeform or edit an entry that uses the Freeform Matrix field, or when I try to remove the Freeform Matrix field from use.

ParseError: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/symfony/property-access/PropertyAccessor.php:36
Stack trace:
#0 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/nfs/c12/h02/mn...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('Symfony\\Compone...')
#2 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/symfony/property-access/PropertyAccessorBuilder.php(131): spl_autoload_call('Symfony\\Compone...')
#3 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/symfony/property-access/PropertyAccess.php(28): Symfony\Component\PropertyAccess\PropertyAccessorBuilder->getPropertyAccessor()
#4 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/AbstractField.php(82): Symfony\Component\PropertyAccess\PropertyAccess::createPropertyAccessor()
#5 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Factories/ComposerFieldFactory.php(75): Solspace\Freeform\Library\Composer\Components\AbstractField::createFromProperties(Object(Solspace\Freeform\Library\Composer\Components\Form), Object(Solspace\Freeform\Library\Composer\Components\Properties\FieldProperties), Object(Solspace\Freeform\Library\Session\FormValueContext), 0)
#6 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/Layout.php(364): Solspace\Freeform\Library\Factories\ComposerFieldFactory::createFromProperties(Object(Solspace\Freeform\Library\Composer\Components\Form), Object(Solspace\Freeform\Library\Composer\Components\Properties\FieldProperties), Object(Solspace\Freeform\Library\Session\FormValueContext), 0)
#7 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/Layout.php(101): Solspace\Freeform\Library\Composer\Components\Layout->buildLayout(Object(Solspace\Freeform\Library\Session\FormValueContext))
#8 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/Form.php(179): Solspace\Freeform\Library\Composer\Components\Layout->__construct(Object(Solspace\Freeform\Library\Composer\Components\Form), Array, Object(Solspace\Freeform\Library\Composer\Components\Properties), Object(Solspace\Freeform\Library\Session\FormValueContext), Object(Solspace\Freeform\Library\Translations\CraftTranslator))
#9 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Composer.php(226): Solspace\Freeform\Library\Composer\Components\Form->__construct(Object(Solspace\Freeform\Library\Composer\Components\Properties), Object(Solspace\Freeform\Library\Composer\Attributes\FormAttributes), Array, Object(Solspace\Freeform\Services\FormsService), Object(Solspace\Freeform\Services\FieldsService), Object(Solspace\Freeform\Services\SubmissionsService), Object(Solspace\Freeform\Services\SpamSubmissionsService), Object(Solspace\Freeform\Services\FilesService), Object(Solspace\Freeform\Library\Translations\CraftTranslator), Object(Monolog\Logger))
#10 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Composer.php(112): Solspace\Freeform\Library\Composer\Composer->validateComposerData(Object(Solspace\Freeform\Library\Composer\Attributes\FormAttributes))
#11 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Models/FormModel.php(141): Solspace\Freeform\Library\Composer\Composer->__construct(Array, Object(Solspace\Freeform\Library\Composer\Attributes\FormAttributes), Object(Solspace\Freeform\Services\FormsService), Object(Solspace\Freeform\Services\FieldsService), Object(Solspace\Freeform\Services\SubmissionsService), Object(Solspace\Freeform\Services\SpamSubmissionsService), Object(Solspace\Freeform\Services\FilesService), Object(Solspace\Freeform\Services\StatusesService), Object(Solspace\Freeform\Library\Translations\CraftTranslator), Object(Monolog\Logger))
#12 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Models/FormModel.php(181): Solspace\Freeform\Models\FormModel->getComposer()
#13 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Variables/FreeformVariable.php(39): Solspace\Freeform\Models\FormModel->getForm()
#14 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Extension/Core.php(1619): Solspace\Freeform\Variables\FreeformVariable->form('contact')
#15 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/helpers/Template.php(73): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(Solspace\Freeform\Variables\FreeformVariable), 'form', Array, 'method', false, false)
#16 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/49/490c1e38c73774194ec4db7b0d434edd73b90ada852ba19a47d7151deaf8baae.php(1134): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(Solspace\Freeform\Variables\FreeformVariable), 'form', Array, 'method')
#17 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(189): __TwigTemplate_df6084533b45dbb97216b53f70d72500723f0c627d73d735f02e06ac485c51df_1371066880->block_content(Array, Array)
#18 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/e1/e18892d07e96f54281b257243b47df5c3c472532bb04f3dcd598cc90f7caf331.php(33): Twig_Template->displayBlock('content', Array, Array)
#19 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_a9075adcd269d2a009f2e9ea0a663da5fb05a154b25ba8bfe126edf0b84781bf->doDisplay(Array, Array)
#20 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#21 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#22 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#23 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/49/490c1e38c73774194ec4db7b0d434edd73b90ada852ba19a47d7151deaf8baae.php(435): craft\web\twig\Template->display(Array, Array)
#24 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_df6084533b45dbb97216b53f70d72500723f0c627d73d735f02e06ac485c51df_1371066880->doDisplay(Array, Array)
#25 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#26 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#27 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#28 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/49/490c1e38c73774194ec4db7b0d434edd73b90ada852ba19a47d7151deaf8baae.php(91): craft\web\twig\Template->display(Array)
#29 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_df6084533b45dbb97216b53f70d72500723f0c627d73d735f02e06ac485c51df->doDisplay(Array, Array)
#30 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#31 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#32 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#33 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/55/5508cdc0a50b370b23f6ec0ba3962a8c8153a034e0b199e7615d133dde1089c9.php(41): craft\web\twig\Template->display(Array)
#34 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(189): __TwigTemplate_b21fc72ed6773279e32ba5c448920e81587c43b17bf5d251d680273efee40c38->block_content(Array, Array)
#35 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/50/50ddd0fb8796360ec27783bd66594cb5d81bb2d0d7c6c3aa7efd96a7d6c6f4b3.php(123): Twig_Template->displayBlock('content', Array, Array)
#36 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_2e2b57df12e19bc3a90c2a8d5cecd81a1a85b4424d1a3677d92914c0df6b3f10->doDisplay(Array, Array)
#37 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#38 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#39 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#40 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/55/5508cdc0a50b370b23f6ec0ba3962a8c8153a034e0b199e7615d133dde1089c9.php(31): craft\web\twig\Template->display(Array, Array)
#41 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_b21fc72ed6773279e32ba5c448920e81587c43b17bf5d251d680273efee40c38->doDisplay(Array, Array)
#42 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#43 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#44 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#45 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(375): craft\web\twig\Template->display(Array)
#46 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template->render(Array)
#47 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/View.php(331): Twig_Environment->render('index', Array)
#48 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/View.php(378): craft\web\View->renderTemplate('index', Array)
#49 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Controller.php(156): craft\web\View->renderPageTemplate('index', Array)
#50 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/controllers/TemplatesController.php(78): craft\web\Controller->renderTemplate('index', Array)
#51 [internal function]: craft\controllers\TemplatesController->actionRender('index', Array)
#52 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#53 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#54 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('render', Array)
#55 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('render', Array)
#56 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('templates/rende...', Array)
#57 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('templates/rende...', Array)
#58 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Application.php(271): yii\web\Application->handleRequest(Object(craft\web\Request))
#59 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#60 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/html/index.php(21): yii\base\Application->run()
#61 {main}
2

That error means that your Craft installation is choking on one of Craft's Composer dependencies that is using newer PHP 7.1 syntax and your current box is using PHP 7.0.x.

Usually when that happens, someone did a Composer install/update locally using a newer version of PHP than what you have on then box you're getting the error on, then deployed the composer.json, composer.lock and vendor folder up using the latest and greatest dependencies Composer thinks you can use.

In cases like this, it's usually better to add something like this to your composer.json file https://github.com/pixelandtonic/craftnet/blob/develop/composer.json#L37-L41

Make sure you set that to the "lowest common PHP denominator" across all of your environments. That way, Composer will never try to bring in a dependency that's greater than any environment can support.

  • Thanks @brad-bell — this was exactly it. I don't know if there's an easier way to correct it, but I essentially backed up the DB/assets and burned everything to the ground and reinstalled being careful to keep php versions set in composer.json. Thanks! – Charlie Triplett Oct 22 '18 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.