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

grav.CRITICAL: Syntax error with Page Security tab - Page Groups #2409

Open
Quitoboss opened this issue Apr 27, 2024 · 1 comment
Open

grav.CRITICAL: Syntax error with Page Security tab - Page Groups #2409

Quitoboss opened this issue Apr 27, 2024 · 1 comment

Comments

@Quitoboss
Copy link

I detected the following bug:
There is in Security tab of page configuration.
If you configure the "Page Groups" with no value or with a group but don't select any specific CRUD permisión when saving it brokes giving the next message:

Server Error
Sorry, something went terribly wrong!
4 - Syntax error
For further details please review your logs/ folder, or enable displaying of errors in your system configuration.

Then in grav.log yo will see:
grav.CRITICAL: Syntax error - Trace: #0 /var/www/vhosts/[...]/user/plugins/flex-objects/classes/Admin/AdminController.php(1861): json_decode('', true, 512, 4194304) #1

And 30 lines more.
8 about AdminController
4 about EventDispatcher
4 about Themes
10 about RequestHandler
etc.

This was found trying to figure out how can I configure a private page for users (With Grav Login Plugin)

Best regards

@pmoreno-rodriguez
Copy link
Contributor

I confirm this error.
Some validation may be missing to prevent the responsible function from passing empty or null data.

(user/plugins/flex-objects/classes/Admin/AdminController.php1861)
I have not tried it. The following maybe works:

protected function jsonDecode(array $data)
     {
         foreach ($data as &$value) {
             if (!empty($value)) {
                 if (is_array($value)) {
                    $value = $this->jsonDecode($value);
                 } else {
                   $value = json_decode($value, true, 512, JSON_THROW_ON_ERROR);
                 }
             }
         }
 
         return $data;
     }

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

No branches or pull requests

2 participants