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

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:

However, these PHP Modules are activated.

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

Thanks so much.

@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’?

Hi @pamtbaau

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

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:

{% 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

@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

@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.

@pmoreno, Nice!

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

  yamllinter [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