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 when opening tab 'Accounts->Configuration' #3418

Closed
lufog opened this issue Aug 5, 2021 · 10 comments
Closed

TypeError when opening tab 'Accounts->Configuration' #3418

lufog opened this issue Aug 5, 2021 · 10 comments

Comments

@lufog
Copy link

lufog commented Aug 5, 2021

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

image

OS: Windows 11
PHP: 8.0.8 ts x64
Server: php -S 0.0.0.0 system\router.php
Grav: 1.7.18 (clean instalation)
Admin plugin: 1.10.18
Flex Objects: 1.0.16

@zigojacko
Copy link

Getting exact same issue here.

@rhukster
Copy link
Member

@zigojacko also on windows?

@zigojacko
Copy link

@zigojacko also on windows?

No, the server hosting is Linux (CentOS 7).

@kbftech
Copy link

kbftech commented Aug 26, 2021

Same error here. Here are the details I could find in a pinch; let me know if any other info could be helpful.

OS: Linux 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
PHP: PHP Version 7.3.27-1~deb10u1
Grav: v1.7.18
Admin: v1.10.18
Flex Objects: v1.0.16

@kbftech
Copy link

kbftech commented Aug 26, 2021

Not sure if my logic is good here but I tried to dump the value of the $path variable. Again, I'm not sure if I am in the right instance of this object when I dumped it, but here is what I added to the file to get the value:

       // If configuration is found in main configuration, use it.
        if (str_starts_with($uri, 'config://')) {
echo 'uri: ';
var_dump($uri);
echo '<br/>';
            $path = strtr(substr($uri, 9,  -5), '/', '.');
echo 'path: ';
var_dump($path);
exit(1);
            return $grav['config']->get($path);
        }

The value I got is the following:

uri: string(27) "config://flex/accounts.yaml"
path: string(13) "flex.accounts"

Let me know if I can help in any way.

@mahagr
Copy link
Member

mahagr commented Aug 26, 2021

Return is missing (array) cast and has been fixed in #3409

@mahagr
Copy link
Member

mahagr commented Aug 26, 2021

I'll look again.

@mahagr
Copy link
Member

mahagr commented Aug 30, 2021

Your fix is broken, too. Did you take a look into my fix in the other issue (7b1a188)?

I may have changed something else before that commit as the code looks different to what you have.

@kbftech
Copy link

kbftech commented Aug 30, 2021

@mahagr, you're right; my bad! The $path was never set because I was missing this line:
$path = strtr(substr($uri, 9, -5), '/', '.');

I rectified my local code to match your fix and it seems to work fine. Thanks again for you help!

NOTE: I will remove my snippets to prevent confusion.

@lufog
Copy link
Author

lufog commented Sep 2, 2021

This bug is fixed in Grav v1.7.19.

@lufog lufog closed this as completed Sep 2, 2021
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

5 participants