Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Server Error "Trying to access array offset on value of type int"

Solved by pamtbaau View solution

Started by Pedro M 5 years ago · 5 replies · 5392 views
5 years ago

Hi there.

I'm migrating my site in Grav 1.6.31 to 1.7, with PHP 7.4, and it seems work fine except the form page, that shows the following message:

Server Error:

Sorry, something went terribly wrong!

0 - An exception has been thrown during the rendering of a template ("Trying to access array offset on value of type int").

If I use PHP 7.3, I don't have any problem with contact form.

All this is in localhost. When I try to configure this in online server, it shows what you can to see in bellow screenshot:

Selection_037|682x500

However, these PHP Modules are activated.

How I can to solver this issue? Can I activate these modules in .htacess?

Thanks so much.

5 years ago

@pmoreno, Although a point-one release of Grav 1.7 seems to be an easy upgrade, there are however breaking changes.

Many breaking changes will be mitigated when using the build-in upgrade methods, but event then, it is wise to check the upgrade guide before upgrading.

Are there any errors in the log files of Apache? And in '/logs/grav/log'?

5 years ago

Hi @pamtbaau

I've activated the option to see the logs in the system.yaml. In localhost, the contact form page show this error:

PHP
Twig \ Error \ RuntimeError

An exception has been thrown during the rendering of a template ("Trying to access array offset on value of type int").

Previous exceptions

Trying to access array offset on value of type int (8)

The error points to the following line on the right:

TWIG
{% if not blueprints or (blueprints.schema.type(field.type)['input@'] ?? true) is same as(true) %}

This code is from the user/plugins/form/templates/forms/default/field.html.twig

I hope this helps to solve the problem.

NOTE: Only happens with PHP 7.4, not with 7.3
Thanks.

5 years ago Solution

@pmoreno, Could it be the same issue as this one on the repo for grav-plugin-form

What does running the following command yield: $ bin/grav yamllinter --all

5 years ago

@pamtbaau , with the command bin/grav yamllinter --all it shows The "--all" option does not exist.

However, if I remove dash from the form fields (like you suggest in the link), it works, the page shows correctly.

Thanks so much for your help.

5 years ago

@pmoreno, Nice!

YAML
$ bin/grav yamllinter --help
Description:
  Checks various files for YAML errors

Usage:
  yamllinter [options]

Options:
  -a, --all              Go through the whole Grav installation
  -f, --folder[=FOLDER]  Go through specific folder
  -h, --help             Display this help message
  -q, --quiet            Do not output any message
  -V, --version          Display this application version
      --ansi             Force ANSI output
      --no-ansi          Disable ANSI output
  -n, --no-interaction   Do not ask any interactive question
      --env[=ENV]        Use environment configuration (defaults to localhost)
      --lang[=LANG]      Language to be used (defaults to en)
  -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
last edited 01/20/21 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1140 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 63 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 138 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 114 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 132 7 months ago