⭐️ If you like Statamic, give it a star on GitHub! ⭐️

ErrorException Undefined index: content

Hey guys, another interesting one. I've used the site migrator to upgrade a small site from v2 to v3. Had some issues with it straight out of the bat, even though the migration went well (removed all addons btw, so just content was migrated).

First thing that popped up was the error message in the title.

ErrorException Undefined index: content

Control panel was working fine but front-end was throwing that error message on all pages. I've cleared all caches and that seemed to have helped.

Next error message was something to do with PHP version array_merge(): Expected parameter 2 to be an array

so I upgraded php from 7.3 -> 7.4.x, this helped and the site is now loading.

But when I tested custom 404 page, which is located in resources/views/errors/404.antlers.html

It throws the ErrorException Undefined index: content instead of showing 404 page.

Some more details from stack trace:

Illuminate\Foundation\Bootstrap\HandleExceptions::handleError vendor/statamic/cms/src/Facades/Endpoint/Parse.php:67

}

/**
 * Checks for and parses front matter.
 *
 * @param  string  $string  Content to parse
 * @return array
 */

public function frontMatter($string)
{
    $data = [];
    $content = $string;

    if (preg_match('/^---[\r\n?|\n]/', $string)) {
        $data = self::YAML($string);
        $content = $data['content'];
        unset($data['content']);
    }

    return compact('data', 'content');
}

Any ideas?

Cheers, Mark

Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
2 Replies
3 Followers