0

Currently upgrading a project from CakePHP2 to CakePHP4 and I received the error Config file "tmi.php" did not return an array.

This is how I'm importing it into bootstrap.php:

try {
    Configure::config('default', new PhpConfig());
    Configure::load('app', 'default', false);
    Configure::load('tmi', 'default');
} catch (\Exception $e) {
    exit($e->getMessage() . "\n");
}

This is an example of what the file contains:

Configure::write('weburl', 'https://weburl.net/');
Configure::write(
    'S3',
    [
        "bucket" => "bucketName",
        "key" => "bucketKey",
        "secret" => "bucketSecret",
    ]
);
Austin Poulson
  • 685
  • 7
  • 22

1 Answers1

1

As the error message suggests, PHP config files for Configure::load() must return an array now.

You can always check the current app template to figure how things are supposed to look like.

return [
    // ...

    'weburl' => 'https://weburl.net/',

    'S3' => [
        "bucket" => "bucketName",
        "key" => "bucketKey",
        "secret" => "bucketSecret",
    ],
];
ndm
  • 59,784
  • 9
  • 71
  • 110