Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Impossible to invoke a method ("hasErrors") on an array #16

Open
proimage opened this issue Mar 12, 2020 · 1 comment
Open

Error: Impossible to invoke a method ("hasErrors") on an array #16

proimage opened this issue Mar 12, 2020 · 1 comment

Comments

@proimage
Copy link

proimage commented Mar 12, 2020

Craft CMS 3.4.5
Colorit 1.0.8 (trialing it)

When I try to go edit an entry locally, I get the error below. When I edit the same entry on stage, no error.

Stage's DB is backed up and restored in my local dev env, and both installs are in sync using Git. 😖

Twig\Error\RuntimeError: Impossible to invoke a method ("hasErrors") on an array. in E:\Projects\craft3\htdocs\vendor\fruitstudios\colorit\src\templates\_fields\colorit\input.twig:79
Stack trace:
#0 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\helpers\Template.php(96): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Array, 'hasErrors', Array, 'method', false, false)
#1 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\1c\1ca8611b67d24f3f5e79078a9dde629b393ae4598fb30d1e31f754a1481d496f.php(217): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Array, 'hasErrors', Array, 'method')
#2 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_a15064393f4376f93be688990f6814c64d22af9b140aa340006943124d79eecb->doDisplay(Array, Array)
#3 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#4 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(392): Twig\Template->display(Array)
#5 E:\Projects\craft3\htdocs\vendor\twig\twig\src\TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#6 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Environment.php(318): Twig\TemplateWrapper->render(Array)
#7 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\View.php(391): Twig\Environment->render('colorit/_fields...', Array)
#8 E:\Projects\craft3\htdocs\vendor\fruitstudios\colorit\src\fields\ColoritField.php(248): craft\web\View->renderTemplate('colorit/_fields...', Array)
#9 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Extension\CoreExtension.php(1499): fruitstudios\colorit\fields\ColoritField->getInputHtml(Array, Object(benf\neo\elements\Block))
#10 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\helpers\Template.php(96): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(fruitstudios\colorit\fields\ColoritField), 'getInputHtml', Array, 'method', false, false)
#11 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\dd\dd6e10eb367046cf0e0b181884890c09708d2a0a7d55325bef86765b6a95080d.php(78): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(fruitstudios\colorit\fields\ColoritField), 'getInputHtml', Array, 'method')
#12 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_1f1b0c91afd3759cf7f2f047567c16b0dbb7b6a408b9949a47c9823b25a049ec->doDisplay(Array, Array)
#13 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#14 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\6f\6fe9f67d3afd66fb59f1ebf84267c1513d397f67b07c98e274b8967dd37920bb.php(85): Twig\Template->display(Array)
#15 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_9153103a6ca48fcab9388b773c6d43c19ec3eda220f6d989ba25ade904f640c5->doDisplay(Array, Array)
#16 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#17 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(392): Twig\Template->display(Array)
#18 E:\Projects\craft3\htdocs\vendor\twig\twig\src\TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#19 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Environment.php(318): Twig\TemplateWrapper->render(Array)
#20 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\View.php(391): Twig\Environment->render('_includes/field...', Array)
#21 E:\Projects\craft3\htdocs\vendor\spicyweb\craft-neo\src\services\Blocks.php(129): craft\web\View->renderTemplate('_includes/field...', Array)
#22 E:\Projects\craft3\htdocs\vendor\spicyweb\craft-neo\src\assets\FieldAsset.php(145): benf\neo\services\Blocks->renderTabs(Object(benf\neo\elements\Block), false)
#23 E:\Projects\craft3\htdocs\vendor\spicyweb\craft-neo\src\assets\FieldAsset.php(109): benf\neo\assets\FieldAsset::_getBlocksJsSettings(Array, false)
#24 E:\Projects\craft3\htdocs\vendor\spicyweb\craft-neo\src\Field.php(895): benf\neo\assets\FieldAsset::createInputJs(Object(benf\neo\Field), Array, false, 1)
#25 E:\Projects\craft3\htdocs\vendor\spicyweb\craft-neo\src\Field.php(346): benf\neo\Field->_getInputHtml(Array, Object(craft\elements\Entry))
#26 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Extension\CoreExtension.php(1499): benf\neo\Field->getInputHtml(Object(benf\neo\elements\db\BlockQuery), Object(craft\elements\Entry))
#27 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\helpers\Template.php(96): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(benf\neo\Field), 'getInputHtml', Array, 'method', false, false)
#28 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\dd\dd6e10eb367046cf0e0b181884890c09708d2a0a7d55325bef86765b6a95080d.php(78): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(benf\neo\Field), 'getInputHtml', Array, 'method')
#29 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_1f1b0c91afd3759cf7f2f047567c16b0dbb7b6a408b9949a47c9823b25a049ec->doDisplay(Array, Array)
#30 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#31 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\6f\6fe9f67d3afd66fb59f1ebf84267c1513d397f67b07c98e274b8967dd37920bb.php(58): Twig\Template->display(Array)
#32 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_9153103a6ca48fcab9388b773c6d43c19ec3eda220f6d989ba25ade904f640c5->doDisplay(Array, Array)
#33 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#34 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\51\517afbb974d07b74e59d2e51ca7ffebc3f8edfb25bde5f6675a95731541d740e.php(79): Twig\Template->display(Array)
#35 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_b71a535d6731005a317d98b5073ffbe8cc4f1277ac5a7f8ab70ac45bdf5538b8->doDisplay(Array, Array)
#36 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#37 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\ca\cab70cc91f036e39fb590e6c2ddc899aae993be59ae6faa3fc5448d905fadc24.php(156): Twig\Template->display(Array)
#38 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(184): __TwigTemplate_87b5caa000b0664e07f98825edf46c148a5c89a1c80515f7cb439aa205467178->block_content(Array, Array)
#39 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\26\26a812d7de25d61a0d8c8ed2501195f25b34ca9a2ea7820724289ee8e09fd8ac.php(411): Twig\Template->displayBlock('content', Array, Array)
#40 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(184): __TwigTemplate_f6615b361a7c1002fc4078d7c310df2227855365824da215e9df46554390b7e3->block_main(Array, Array)
#41 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(147): Twig\Template->displayBlock('main', Array, Array, false)
#42 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\57\571a8036864f2367680435bc6b759093057d4619bb9790473823638991373aec.php(546): Twig\Template->displayParentBlock('main', Array, Array)
#43 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(184): __TwigTemplate_7efeb65c6267e20fa3a98d97f689d7ec2154417e145ff3524b9b639647d00cd3->block_main(Array, Array)
#44 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\26\26a812d7de25d61a0d8c8ed2501195f25b34ca9a2ea7820724289ee8e09fd8ac.php(266): Twig\Template->displayBlock('main', Array, Array)
#45 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(184): __TwigTemplate_f6615b361a7c1002fc4078d7c310df2227855365824da215e9df46554390b7e3->block_body(Array, Array)
#46 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\d8\d848643c093a6ea240921143f16a201eca15ed6445f91e783991710138005f98.php(75): Twig\Template->displayBlock('body', Array, Array)
#47 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_8407d57ff4c98c127de90f7d706b896e59dbdf68eb3a4b4d9a6bc9d75bdbfd50->doDisplay(Array, Array)
#48 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#49 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\c4\c4d2fb6ff63435a5d5214451eaf4b5637bfeab1afcd700ab241f4a3135e98403.php(56): Twig\Template->display(Array, Array)
#50 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_7942f87b9a3114df136d132e3e6f5232363ee31243048fa4836ae961d151323c->doDisplay(Array, Array)
#51 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#52 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\26\26a812d7de25d61a0d8c8ed2501195f25b34ca9a2ea7820724289ee8e09fd8ac.php(138): Twig\Template->display(Array, Array)
#53 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_f6615b361a7c1002fc4078d7c310df2227855365824da215e9df46554390b7e3->doDisplay(Array, Array)
#54 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#55 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\57\571a8036864f2367680435bc6b759093057d4619bb9790473823638991373aec.php(222): Twig\Template->display(Array, Array)
#56 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_7efeb65c6267e20fa3a98d97f689d7ec2154417e145ff3524b9b639647d00cd3->doDisplay(Array, Array)
#57 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#58 E:\Projects\craft3\htdocs\storage\runtime\compiled_templates\ca\cab70cc91f036e39fb590e6c2ddc899aae993be59ae6faa3fc5448d905fadc24.php(120): Twig\Template->display(Array, Array)
#59 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(407): __TwigTemplate_87b5caa000b0664e07f98825edf46c148a5c89a1c80515f7cb439aa205467178->doDisplay(Array, Array)
#60 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#61 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Template.php(392): Twig\Template->display(Array)
#62 E:\Projects\craft3\htdocs\vendor\twig\twig\src\TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#63 E:\Projects\craft3\htdocs\vendor\twig\twig\src\Environment.php(318): Twig\TemplateWrapper->render(Array)
#64 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\View.php(391): Twig\Environment->render('entries/_edit', Array)
#65 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\View.php(452): craft\web\View->renderTemplate('entries/_edit', Array)
#66 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\Controller.php(235): craft\web\View->renderPageTemplate('entries/_edit', Array, 'cp')
#67 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\controllers\EntriesController.php(248): craft\web\Controller->renderTemplate('entries/_edit', Array)
#68 [internal function]: craft\controllers\EntriesController->actionEditEntry(Object(craft\models\Section), 44848, NULL, NULL, Object(craft\models\Site), Object(craft\elements\Entry))
#69 E:\Projects\craft3\htdocs\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#70 E:\Projects\craft3\htdocs\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#71 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\Controller.php(178): yii\base\Controller->runAction('edit-entry', Array)
#72 E:\Projects\craft3\htdocs\vendor\yiisoft\yii2\base\Module.php(528): craft\web\Controller->runAction('edit-entry', Array)
#73 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\Application.php(290): yii\base\Module->runAction('entries/edit-en...', Array)
#74 E:\Projects\craft3\htdocs\vendor\yiisoft\yii2\web\Application.php(103): craft\web\Application->runAction('entries/edit-en...', Array)
#75 E:\Projects\craft3\htdocs\vendor\craftcms\cms\src\web\Application.php(275): yii\web\Application->handleRequest(Object(craft\web\Request))
#76 E:\Projects\craft3\htdocs\vendor\yiisoft\yii2\base\Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#77 E:\Projects\craft3\htdocs\web\index.php(21): yii\base\Application->run()
#78 {main}
@proimage
Copy link
Author

For what it's worth, I got around this by commenting out these lines at the bottom of /src/templates/_fields/colorit/input.twig:

{% if value and value.hasErrors() %}
	{% for error in value.getErrors() %}
		{{ forms.errorList(error) }}
	{% endfor %}
{% endif %}

After that I was able to refresh the Edit Entry page and it loaded. Then I disabled the Neo blocks that had Colorit fields, saved the entry, and uncommented out the code. Finally, I re-enabled the blocks one-by-one to see if I could find which field was the culprit, saving the entry after each block. However, the problem seems to have been resolved by something in that process; I was able to re-enable all the blocks with Colorit fields and the page loads without a hitch anymore.

I hate mysterious solutions... :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant