Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError FlexDirectory.php ? #3412

Closed
jchalifour opened this issue Jul 22, 2021 · 5 comments
Closed

TypeError FlexDirectory.php ? #3412

jchalifour opened this issue Jul 22, 2021 · 5 comments

Comments

@jchalifour
Copy link

jchalifour commented Jul 22, 2021

I just started experimenting with Grav on 1.7.17 about a week ago, then upgraded to 1.7.18 the other day and started getting an error when I clicked the blue Configuration button of the Pages admin interface. I'm just using my localhost setup of Apache 2.4.48, PHP 8.0.8 on Manjaro Linux. The error is:

TypeError
Grav\Framework\Flex\FlexDirectory::loadDirectoryConfig(): Return value must be of type array, null returned

I tried a completely fresh installation of 1.7.18 with no additional plugins, content, or customizations and got the same thing. Then investigating some more, it showed the following:

/srv/http/grav-admin/system/src/Grav/Framework/Flex/FlexDirectory.php

        }
     
        /**
         * @param string $name
         * @return array
         * @internal
         */
        public function loadDirectoryConfig(string $name): array
        {
            $grav = Grav::instance();
     
            /** @var UniformResourceLocator $locator */
            $locator = $grav['locator'];
            $uri = $this->getDirectoryConfigUri($name);
     
            // If configuration is found in main configuration, use it.
            if (str_starts_with($uri, 'config://')) {
                $path = strtr(substr($uri, 9,  -5), '/', '.');
     
                return $grav['config']->get($path);
            }
     
            // Load the configuration file.
            $filename = $locator->findResource($uri, true);
            if ($filename === false) {
                return [];
            }
     
            $file = YamlFile::instance($filename);
     
            return $file->content();
        }
     
        /**
         * @param string|null $name
         * @return string
         */
        public function getDirectoryConfigUri(string $name = null): string
        {
            $name = $name ?: $this->getFlexType();

Arguments

    "Grav\Framework\Flex\FlexDirectory::loadDirectoryConfig(): Return value must be of type array, null returned"

I'm new to this so not sure really what is happening however based on that message I did an experiment and reverted the FlexDirectory.php file to the one from version 1.7.17. All seems to work fine again. Note: I also noticed this issue with the Configuration tab in the Accounts section of the admin interface.

I hope this helps.

@JohnMica
Copy link

seems it is the same as 3409

@jchalifour
Copy link
Author

Oh, yes I think so, sorry I didn't see that before posting.

@mahagr
Copy link
Member

mahagr commented Jul 22, 2021

Let us continue in the other report.

@mahagr mahagr closed this as completed Jul 22, 2021
@JohnMica
Copy link

At least yours has more php details for the guys to take a look at. So both combined could help, no?

@mahagr
Copy link
Member

mahagr commented Jul 23, 2021

Already fixed it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants