verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
96 stars 73 forks source link

Backend: Twig Runtime Error when editing submission #294

Closed AmandaLutzTO closed 3 years ago

AmandaLutzTO commented 3 years ago

From Craft backend, get Twig Runtime Error when I click on submission.

Impossible to access an attribute ("cpEditUrl") on a string variable ("24"). in /home/.../vendor/verbb/formie/src/templates/submissions/_edit.html {{ submission.user }}

Steps to reproduce

  1. Create Formie submission
  2. Try to view/edit in Craft backend

Form settings

Additional info

Additional context Happening on all submissions from all forms

engram-design commented 3 years ago

I think this might be cause you have a field with the handle user is the form, correct? Otherwise, I can't see how that would end up being a string of 24. Are you able to post the full stack trace error with devMode on, just so I'm looking in the right place.

I have just made a slight improvement to this in the latest branch. To get the fix early, change your verbb/formie requirement in composer.json to:

"require": {
  "verbb/formie": "dev-craft-3 as 1.3.9",
  "...": "..."
}

Then run composer update.

AmandaLutzTO commented 3 years ago
Web.log attached. I’m not 100% sure what you mean by “full stack trace error” but here’s all the content on the twig runtime error page (please let me know if I’m way off and something else would be more useful):  Twig Runtime Error – Twig\Error\RuntimeErrorImpossible to access an attribute ("cpEditUrl") on a string variable ("24").1. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/templates/submissions/_edit.htmlat line 202193194195196197198199200201202203204205206207208209210211 {% if submission.user %}   
       
           
                           
            
                {{ submission.user }}           
       
   
{% endif %}
    {% block meta %}        {% if submission.isIncomplete %}           
2. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/helpers/Template.php at line 106– twig_get_attribute(craft\web\twig\Environment, Twig\Source, '24', 'cpEditUrl', ...)100101102103104105106107108109110111112        // Add deprecated support for the old DateTime methods        if ($object instanceof \DateTime && ($value = self::_dateTimeAttribute($object, $item, $type)) !== false) {            return $value;        }         try {            return \twig_get_attribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);        } catch (UnknownMethodException $e) {            // Copy twig_get_attribute()'s BadMethodCallException handling            if ($ignoreStrictCheck || !$env->isStrictVariables()) {                return null;            }            throw new RuntimeError($e->getMessage(), -1, $source);3. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/templates/submissions/_edit.html at line 202– craft\helpers\Template::attribute(craft\web\twig\Environment, Twig\Source, '24', 'cpEditUrl', ...)196197198199200201202203204205206207208        
           
                           
            
                {{ submission.user }}           
       
   
{% endif %}
4. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 184– __TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4::block_details(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ...])5. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 256– Twig\Template::displayBlock('details', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ..], true)6. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/templates/_layouts/cp.html at line 70– Twig\Template::renderBlock('details', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ...])64656667686970717273747576{% set licensedEdition = craft.app.getLicensedEdition() %}{% set isTrial = licensedEdition is not same as(null) and licensedEdition is not same as(CraftEdition) %} {% set sidebar = (sidebar ?? block('sidebar') ?? '')|trim %}{% set toolbar = (toolbar ?? block('toolbar') ?? '')|trim %}{% set actionButton = (block('actionButton') ?? '')|trim %}{% set details = (details ?? block('details') ?? '')|trim %}{% set footer = (footer ?? block('footer') ?? '')|trim %}{% set crumbs = crumbs ?? null %}{% set tabs = tabs is defined and tabs|length != 1 ? tabs : null %} {% set mainContentClasses = [    sidebar ? 'has-sidebar',7. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 407– __TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e::doDisplay(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ...])8. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 380– Twig\Template::displayWithErrorHandling(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ...])9. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/templates/submissions/_edit.html at line 1– Twig\Template::display(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['actionButton' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_actionButton'], 'content' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_content'], 'details' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_details'], 'meta' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_meta']])1234567{% extends '_layouts/cp' %}{% import '_includes/forms' as forms %}{% import 'verbb-base/_macros' as macros %} {% do view.registerAssetBundle('verbb\\formie\\web\\assets\\cp\\CpAsset') -%} {% set jsFile = view.getAssetManager().getPublishedUrl('@verbb/formie/web/assets/frontend/dist/js/formie.js', true) %}10. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 407– __TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4::doDisplay(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['actionButton' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_actionButton'], 'content' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_content'], 'details' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_details'], 'meta' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_meta']])11. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 380– Twig\Template::displayWithErrorHandling(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['actionButton' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_actionButton'], 'content' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_content'], 'details' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_details'], 'meta' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_meta']])12. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 392– Twig\Template::display(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])13. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/TemplateWrapper.php at line 45– Twig\Template::render(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], [])14. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Environment.php at line 318– Twig\TemplateWrapper::render(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])15. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/View.php at line 389– Twig\Environment::render('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])383384385386387388389390391392393394395        // Render and return        $renderingTemplate = $this->_renderingTemplate;        $this->_renderingTemplate = $template;         $e = null;        try {            $output = $this->getTwig()->render($template, $variables);        } catch (\Throwable $e) {            // throw it later        }         $this->_renderingTemplate = $renderingTemplate;        $this->setTemplateMode($oldTemplateMode);16. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/View.php at line 450– craft\web\View::renderTemplate('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])444445446447448449450451452453454455456        $isRenderingPageTemplate = $this->_isRenderingPageTemplate;        $this->_isRenderingPageTemplate = true;         $e = null;        try {            $this->beginPage();            echo $this->renderTemplate($template, $variables);            $this->endPage();        } catch (\Throwable $e) {            // throw it later        }         $this->_isRenderingPageTemplate = $isRenderingPageTemplate;17. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Controller.php at line 241– craft\web\View::renderPageTemplate('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], 'cp')235236237238239240241242243244245246247        }         // Prevent a response formatter from overriding the content-type header        $this->response->format = YiiResponse::FORMAT_RAW;         // Render and return the template        $this->response->data = $view->renderPageTemplate($template, $variables, $templateMode);         // Set the MIME type for the request based on the matched template's file extension (unless the        // Content-Type header was already set, perhaps by the template via the {% header %} tag)        $headers = $this->response->getHeaders();        if (!$headers->has('content-type')) {            $templateFile = StringHelper::removeRight(strtolower($view->resolveTemplate($template)), '.twig');18. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/controllers/SubmissionsController.php at line 129– craft\web\Controller::renderTemplate('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])123124125126127128129130131132133134135        $formConfigJson = $variables['submission']->getForm()->getFrontEndJsVariables();         // Add some settings just for submission editing        $formConfigJson['settings']['outputJsTheme'] = false;        $variables['formConfigJson'] = $formConfigJson;         return $this->renderTemplate('formie/submissions/_edit', $variables);    }     /**     * Saves a submission.     *     * @return Response|null19. verbb\formie\controllers\SubmissionsController::actionEditSubmission(15389, null, null)20. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/InlineAction.php at line 57– call_user_func_array([verbb\formie\controllers\SubmissionsController, 'actionEditSubmission'], [15389, null, null])21. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/Controller.php at line 180– yii\base\InlineAction::runWithParams(['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])22. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Controller.php at line 190– yii\base\Controller::runAction('edit-submission', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])184185186187188189190191192193194195196    /**     * @inheritdoc     */    public function runAction($id, $params = [])    {        try {            return parent::runAction($id, $params);        } catch (\Throwable $e) {            if ($this->request->getAcceptsJson()) {                Craft::$app->getErrorHandler()->logException($e);                if (!YII_DEBUG && !$e instanceof UserException) {                    $message = Craft::t('app', 'A server error occurred.');                } else {23. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/Module.php at line 528– craft\web\Controller::runAction('edit-submission', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])24. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Application.php at line 274– yii\base\Module::runAction('formie/submissions/edit-submissi...', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])268269270271272273274275276277278279280     * @param string $route     * @param array $params     * @return Response|null The result of the action, normalized into a Response object     */    public function runAction($route, $params = [])    {        $result = parent::runAction($route, $params);         if ($result !== null) {            if ($result instanceof Response) {                return $result;            } 25. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/web/Application.php at line 103– craft\web\Application::runAction('formie/submissions/edit-submissi...', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])26. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Application.php at line 259– yii\web\Application::handleRequest(craft\web\Request)253254255256257258259260261262263264265        if (($response = $this->_processActionRequest($request)) !== null) {            return $response;        }         // If we're still here, finally let Yii do it's thing.        try {            return parent::handleRequest($request);        } catch (\Throwable $e) {            $this->_unregisterDebugModule();            throw $e;        }    } 27. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/Application.php at line 386– craft\web\Application::handleRequest(craft\web\Request)28. in /home/safetyre/dev.safetyreports.ca/public_html/index.php at line 21– yii\base\Application::run()15161718192021    (new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();} // Load and run Craftdefine('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';$app->run();$_GET = [    'p' => 'admin/formie/submissions/edit/15389',]; $_COOKIE = [    '1031b8c41dfff97a311a7ac99863bdc5_username' => '18b20dca0a4c2a3c992df985b249be20943cdc30a5c5a711e378a66cfa026d6ca:2:{i:0;s:41:"1031b8c41dfff97a311a7ac99863bdc5_username";i:1;s:10:"safe_admin";}',    '__stripe_mid' => '514d1456-7095-49e8-a4d8-2e67a88dd7a8',    'CraftSessionId' => 'd5dba24353482b8a20cde9020909bc01',    'CRAFT_CSRF_TOKEN' => '2566cb3c4f2996cf931354c7cdfd87f3a8df0a0d613c06f80b471cb4ab5c137ba:2:{i:0;s:16:"CRAFT_CSRF_TOKEN";i:1;s:208:"lpd9w6RBNbc8a36s3amBn4LB0deLtch-43kAEVye|5a46eba5700a923ec4bdd68435ef9ced9aff6dee5654b73f9c92a42f42b4c27flpd9w6RBNbc8a36s3amBn4LB0deLtch-43kAEVye|1|$2y$13$DsMcJBPKYlo/cu7hz62CUuLjz3HYUUtrvicMwr96ey8FXK.VfNbBm";}',]; $_SESSION = [    'bd62416aa8538ede709019a5e113eea5__flash' => [],    '1031b8c41dfff97a311a7ac99863bdc5__token' => '_bowbr8OryU8_HAa1nowWsktRbDMlTpYxUIkVz9-hvzmZhLS6AiiAu2GCRmgWSqLLB0Z6TUSR7GJg7gBrarTeJUiVHL9IWsmuVTT',    '1031b8c41dfff97a311a7ac99863bdc5__id' => 1,];2021-01-15, 09:43:15Yii Framework/2.0.38  From: Josh CrawfordSent: January 14, 2021 3:09 AMTo: verbb/formieCc: Amanda Lutz; AuthorSubject: Re: [verbb/formie] Backend: Twig Runtime Error when editing submission (#294) I think this might be cause you have a field with the handle user is the form, correct? Otherwise, I can't see how that would end up being a string of 24. Are you able to post the full stack trace error with devMode on, just so I'm looking in the right place.I have just made a slight improvement to this in the latest branch. To get the fix early, change your verbb/formie requirement in composer.json to:"require": {  "verbb/formie": "dev-craft-3 as 1.3.9",  "...": "..."}Then run composer update.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
AmandaLutzTO commented 3 years ago
I played around with plugin code on local dev environment and it’s the submitting user info being displayed on the right:   From: Amanda LutzSent: January 15, 2021 10:47 AMTo: verbb/formie; verbb/formieCc: AuthorSubject: RE: [verbb/formie] Backend: Twig Runtime Error when editing submission (#294) Web.log attached. I’m not 100% sure what you mean by “full stack trace error” but here’s all the content on the twig runtime error page (please let me know if I’m way off and something else would be more useful):  Twig Runtime Error – Twig\Error\RuntimeErrorImpossible to access an attribute ("cpEditUrl") on a string variable ("24").1. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/templates/submissions/_edit.htmlat line 202193194195196197198199200201202203204205206207208209210211 {% if submission.user %}   
       
           
                           
            
                {{ submission.user }}           
       
   
{% endif %}
    {% block meta %}        {% if submission.isIncomplete %}           
2. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/helpers/Template.php at line 106– twig_get_attribute(craft\web\twig\Environment, Twig\Source, '24', 'cpEditUrl', ...)100101102103104105106107108109110111112        // Add deprecated support for the old DateTime methods        if ($object instanceof \DateTime && ($value = self::_dateTimeAttribute($object, $item, $type)) !== false) {            return $value;        }         try {            return \twig_get_attribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);        } catch (UnknownMethodException $e) {            // Copy twig_get_attribute()'s BadMethodCallException handling            if ($ignoreStrictCheck || !$env->isStrictVariables()) {                return null;            }            throw new RuntimeError($e->getMessage(), -1, $source);3. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/templates/submissions/_edit.html at line 202– craft\helpers\Template::attribute(craft\web\twig\Environment, Twig\Source, '24', 'cpEditUrl', ...)196197198199200201202203204205206207208        
           
                           
            
                {{ submission.user }}           
       
   
{% endif %}
4. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 184– __TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4::block_details(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ..])5. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 256– Twig\Template::displayBlock('details', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ..], true)6. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/templates/_layouts/cp.html at line 70– Twig\Template::renderBlock('details', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ...])64656667686970717273747576{% set licensedEdition = craft.app.getLicensedEdition() %}{% set isTrial = licensedEdition is not same as(null) and licensedEdition is not same as(CraftEdition) %} {% set sidebar = (sidebar ?? block('sidebar') ?? '')|trim %}{% set toolbar = (toolbar ?? block('toolbar') ?? '')|trim %}{% set actionButton = (block('actionButton') ?? '')|trim %}{% set details = (details ?? block('details') ?? '')|trim %}{% set footer = (footer ?? block('footer') ?? '')|trim %}{% set crumbs = crumbs ?? null %}{% set tabs = tabs is defined and tabs|length != 1 ? tabs : null %} {% set mainContentClasses = [    sidebar ? 'has-sidebar',7. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 407– __TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e::doDisplay(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ...])8. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 380– Twig\Template::displayWithErrorHandling(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ..], ['body' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_body'], 'mainFormAttributes' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_mainFormAttributes'], 'header' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_header'], 'pageTitle' => [__TwigTemplate_ea558bf382680305192bb4c1a7d943a3198b30fff682ce292803d7415903627e, 'block_pageTitle'], ...])9. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/templates/submissions/_edit.html at line 1– Twig\Template::display(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['actionButton' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_actionButton'], 'content' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_content'], 'details' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_details'], 'meta' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_meta']])1234567{% extends '_layouts/cp' %}{% import '_includes/forms' as forms %}{% import 'verbb-base/_macros' as macros %} {% do view.registerAssetBundle('verbb\\formie\\web\\assets\\cp\\CpAsset') -%} {% set jsFile = view.getAssetManager().getPublishedUrl('@verbb/formie/web/assets/frontend/dist/js/formie.js', true) %}10. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 407– __TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4::doDisplay(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['actionButton' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_actionButton'], 'content' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_content'], 'details' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_details'], 'meta' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_meta']])11. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 380– Twig\Template::displayWithErrorHandling(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], ['actionButton' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_actionButton'], 'content' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_content'], 'details' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_details'], 'meta' => [__TwigTemplate_e25c677ebdd08dcef51a235207ca22953984b9207d9a71a9345336ee17df50c4, 'block_meta']])12. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Template.php at line 392– Twig\Template::display(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])13. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/TemplateWrapper.php at line 45– Twig\Template::render(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], [])14. in /home/safetyre/dev.safetyreports.ca/vendor/twig/twig/src/Environment.php at line 318– Twig\TemplateWrapper::render(['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])15. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/View.php at line 389– Twig\Environment::render('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])383384385386387388389390391392393394395        // Render and return        $renderingTemplate = $this->_renderingTemplate;        $this->_renderingTemplate = $template;         $e = null;        try {            $output = $this->getTwig()->render($template, $variables);        } catch (\Throwable $e) {            // throw it later        }         $this->_renderingTemplate = $renderingTemplate;        $this->setTemplateMode($oldTemplateMode);16. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/View.php at line 450– craft\web\View::renderTemplate('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])444445446447448449450451452453454455456        $isRenderingPageTemplate = $this->_isRenderingPageTemplate;        $this->_isRenderingPageTemplate = true;         $e = null;        try {            $this->beginPage();            echo $this->renderTemplate($template, $variables);            $this->endPage();        } catch (\Throwable $e) {            // throw it later        }         $this->_isRenderingPageTemplate = $isRenderingPageTemplate;17. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Controller.php at line 241– craft\web\View::renderPageTemplate('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...], 'cp')235236237238239240241242243244245246247        }         // Prevent a response formatter from overriding the content-type header        $this->response->format = YiiResponse::FORMAT_RAW;         // Render and return the template        $this->response->data = $view->renderPageTemplate($template, $variables, $templateMode);         // Set the MIME type for the request based on the matched template's file extension (unless the        // Content-Type header was already set, perhaps by the template via the {% header %} tag)        $headers = $this->response->getHeaders();        if (!$headers->has('content-type')) {            $templateFile = StringHelper::removeRight(strtolower($view->resolveTemplate($template)), '.twig');18. in /home/safetyre/dev.safetyreports.ca/vendor/verbb/formie/src/controllers/SubmissionsController.php at line 129– craft\web\Controller::renderTemplate('formie/submissions/_edit', ['submissionId' => 15389, 'submission' => verbb\formie\elements\Submission, 'siteIds' => [1], 'site' => craft\models\Site, ...])123124125126127128129130131132133134135        $formConfigJson = $variables['submission']->getForm()->getFrontEndJsVariables();         // Add some settings just for submission editing        $formConfigJson['settings']['outputJsTheme'] = false;        $variables['formConfigJson'] = $formConfigJson;         return $this->renderTemplate('formie/submissions/_edit', $variables);    }     /**     * Saves a submission.     *     * @return Response|null19. verbb\formie\controllers\SubmissionsController::actionEditSubmission(15389, null, null)20. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/InlineAction.php at line 57– call_user_func_array([verbb\formie\controllers\SubmissionsController, 'actionEditSubmission'], [15389, null, null])21. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/Controller.php at line 180– yii\base\InlineAction::runWithParams(['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])22. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Controller.php at line 190– yii\base\Controller::runAction('edit-submission', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])184185186187188189190191192193194195196    /**     * @inheritdoc     */    public function runAction($id, $params = [])    {        try {            return parent::runAction($id, $params);        } catch (\Throwable $e) {            if ($this->request->getAcceptsJson()) {                Craft::$app->getErrorHandler()->logException($e);                if (!YII_DEBUG && !$e instanceof UserException) {                    $message = Craft::t('app', 'A server error occurred.');                } else {23. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/Module.php at line 528– craft\web\Controller::runAction('edit-submission', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])24. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Application.php at line 274– yii\base\Module::runAction('formie/submissions/edit-submissi...', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])268269270271272273274275276277278279280     * @param string $route     * @param array $params     * @return Response|null The result of the action, normalized into a Response object     */    public function runAction($route, $params = [])    {        $result = parent::runAction($route, $params);         if ($result !== null) {            if ($result instanceof Response) {                return $result;            } 25. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/web/Application.php at line 103– craft\web\Application::runAction('formie/submissions/edit-submissi...', ['submissionId' => '15389', 'p' => 'admin/formie/submissions/edit/15...'])26. in /home/safetyre/dev.safetyreports.ca/vendor/craftcms/cms/src/web/Application.php at line 259– yii\web\Application::handleRequest(craft\web\Request)253254255256257258259260261262263264265        if (($response = $this->_processActionRequest($request)) !== null) {            return $response;        }         // If we're still here, finally let Yii do it's thing.        try {            return parent::handleRequest($request);        } catch (\Throwable $e) {            $this->_unregisterDebugModule();            throw $e;        }    } 27. in /home/safetyre/dev.safetyreports.ca/vendor/yiisoft/yii2/base/Application.php at line 386– craft\web\Application::handleRequest(craft\web\Request)28. in /home/safetyre/dev.safetyreports.ca/public_html/index.php at line 21– yii\base\Application::run()15161718192021    (new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();} // Load and run Craftdefine('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';$app->run();$_GET = [    'p' => 'admin/formie/submissions/edit/15389',]; $_COOKIE = [    '1031b8c41dfff97a311a7ac99863bdc5_username' => '18b20dca0a4c2a3c992df985b249be20943cdc30a5c5a711e378a66cfa026d6ca:2:{i:0;s:41:"1031b8c41dfff97a311a7ac99863bdc5_username";i:1;s:10:"safe_admin";}',    '__stripe_mid' => '514d1456-7095-49e8-a4d8-2e67a88dd7a8',    'CraftSessionId' => 'd5dba24353482b8a20cde9020909bc01',    'CRAFT_CSRF_TOKEN' => '2566cb3c4f2996cf931354c7cdfd87f3a8df0a0d613c06f80b471cb4ab5c137ba:2:{i:0;s:16:"CRAFT_CSRF_TOKEN";i:1;s:208:"lpd9w6RBNbc8a36s3amBn4LB0deLtch-43kAEVye|5a46eba5700a923ec4bdd68435ef9ced9aff6dee5654b73f9c92a42f42b4c27flpd9w6RBNbc8a36s3amBn4LB0deLtch-43kAEVye|1|$2y$13$DsMcJBPKYlo/cu7hz62CUuLjz3HYUUtrvicMwr96ey8FXK.VfNbBm";}',]; $_SESSION = [    'bd62416aa8538ede709019a5e113eea5__flash' => [],    '1031b8c41dfff97a311a7ac99863bdc5__token' => '_bowbr8OryU8_HAa1nowWsktRbDMlTpYxUIkVz9-hvzmZhLS6AiiAu2GCRmgWSqLLB0Z6TUSR7GJg7gBrarTeJUiVHL9IWsmuVTT',    '1031b8c41dfff97a311a7ac99863bdc5__id' => 1,];2021-01-15, 09:43:15Yii Framework/2.0.38  From: Josh CrawfordSent: January 14, 2021 3:09 AMTo: verbb/formieCc: Amanda Lutz; AuthorSubject: Re: [verbb/formie] Backend: Twig Runtime Error when editing submission (#294) I think this might be cause you have a field with the handle user is the form, correct? Otherwise, I can't see how that would end up being a string of 24. Are you able to post the full stack trace error with devMode on, just so I'm looking in the right place.I have just made a slight improvement to this in the latest branch. To get the fix early, change your verbb/formie requirement in composer.json to:"require": {  "verbb/formie": "dev-craft-3 as 1.3.9",  "...": "..."}Then run composer update.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.  
engram-design commented 3 years ago

Thanks @AmandaLutzTO what I was after was a screenshot of the error with devMode on, as the HTML you've added is pretty difficult to make out unfortunately.

engram-design commented 3 years ago

I should also note this is fixed in the latest branch, as I can see you have a field with the handle user causing an issue here. Will be fixed in the next release

engram-design commented 3 years ago

Fixed in 1.3.10