Call to undefined function config after upgrading to Sage 10.0.0-Beta.3

I’ve recently upgraded sage to the latest version, after upgrading the Roots\config() function is now giving an error that \config() is undefined.

My setup uses bedrock and I’ve added acorn via composer as per the docs.

I’ve tried removing my vendor folder and composer.lock and reinstalling in both bedrock and sage. I’ve also tried composer dump-autoload.

I’ve looked at another project I have that use an older version of sage (it’s using acorn 2.0.0-alpha.0) and that has access to Roots\app but the updated version does not.

I was wondering if this was an issue with my setup so I created a new project from scratch and the results are the same. Here’s the steps I’m taking to setup the project, is there something I’m missing?

  • Create a new bedrock project composer create-project roots/bedrock
  • composer install
  • Install acorn composer require roots/acorn
  • Add post-autoload-dump script to composer.json
  • cd into the themes folder and composer create-project roots/sage exampletheme 10.0.0-beta.3
  • wp theme activate exampletheme
  • Open app/setup.php and add any of the following to see the error:
    • \config()
    • \Roots\config()
    • \app()

Fixed the issue, it looks like to get access to config() and other functions you now need to make sure you are within an action such as ‘init’

1 Like