After upgrading from Craft 3 to Craft 4, the backend is accessible but the frontend displays the error:
PHP Warning – yii\base\ErrorException Array to string conversion
And points to many files:
Such as:
in /app/vendor/craftcms/cms/src/helpers/Db.phpat line 604
595596597598599600601602603604605606607608609610611612613 $condition[] = [$column => $val];
continue;
}
if (
static::isNumericColumnType($columnType) &&
$val !== ':empty:' &&
!is_numeric($val)
) {
throw new InvalidArgumentException("Invalid numeric value: $val");
}
}
if ($val === ':empty:') {
// If this is a textual column type, also check for empty strings
if (
($columnType === null && $isMysql) ||
($columnType !== null && static::isTextualColumnType($columnType))
) {
or
in /app/templates/_components/header.twig at line 25– craft\helpers\Template::attribute(craft\web\twig\Environment, Twig\Source, craft\elements\db\CategoryQuery, 'all', ...)
19202122232425262728293031{% set solutionsLevel2 = null %}
{% set pageType = entry.type ??? null %}
{# Get all descendants of level 2 #}
{% if mainMenu %}
{{ dump(mainMenu) }}
{% set solutions = craft.categories().group('solutions').id([mainMenu.ids()]).all() ??? null %}
{% else %}
{% set solutions = craft.categories().group('solutions').all() ??? null %}
{% endif %}
{% if solutions %}
{% set solutionsLevel2 = solutions|filter(v => v.level == 2) ??? null %}
or
in /app/templates/_base/base-web-layout.twig at line 101– Twig\Template::display(['entry' => craft\elements\Entry, 'variables' => ['entry' => craft\elements\Entry], 'craft' => craft\web\twig\variables\CraftVariable, 'currentSite' => craft\models\Site, ...])
9596979899100101102103104105106107
{% if cookieBannerSnippet %}
{{ cookieBannerSnippet|raw }}
{% endif %}
{% endblock bodyTag %}
{% include "_components/header.twig" %}
{# -- Page content that should be included in the <body> -- #}
{% block bodyContent %}{% endblock bodyContent %}
{# do not cache footer because of form #}
{% include "_components/footer.twig" %}
or
in /app/templates/_base/base-web-layout.twig at line 1– Twig\Template::displayBlock('htmlPage', ['entry' => craft\elements\Entry, 'variables' => ['entry' => craft\elements\Entry], 'craft' => craft\web\twig\variables\CraftVariable, 'currentSite' => craft\models\Site, ...], ['htmlPage' => [__TwigTemplate_e46420d563df21c4bfb0ea5103d757fa, 'block_htmlPage'], 'htmlTag' => [__TwigTemplate_e46420d563df21c4bfb0ea5103d757fa, 'block_htmlTag'], 'headTag' => [__TwigTemplate_e46420d563df21c4bfb0ea5103d757fa, 'block_headTag'], 'headContent' => [__TwigTemplate_e46420d563df21c4bfb0ea5103d757fa, 'block_headContent'], ...])
1234567{%- block htmlPage -%}
<!DOCTYPE html>
{% block htmlTag %}
<html lang="{{ craft.app.language |slice(0,2) }}" class="h-full">
{% endblock htmlTag %}
{% block headTag %}
There are more examples.
I am not sure if these are all related.
I have tried to delete /storage/runtime/compiled_templates
I have also tried nuking the /vendor folder and running composer install
again.
None of this has helped unfortunately.