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

JSONtoChunk Snippet crashes if location is empty #32

Open
MrDigii opened this issue Aug 22, 2022 · 0 comments
Open

JSONtoChunk Snippet crashes if location is empty #32

MrDigii opened this issue Aug 22, 2022 · 0 comments

Comments

@MrDigii
Copy link

MrDigii commented Aug 22, 2022

If no location is set the JSONtoChunk Snippet crashed while trying to convert JSON to array.
Possible fix can be a guardian. Tested modification:

if (!$input) return "null";

$array = $modx->fromJSON($input);
if (count($array) > 0) {
    $chunk = $modx->getObject('modChunk', array('name' => $options));
    if ($chunk) {
        $output = $chunk->process($array);
    }
}
return $output;
Alexij2 added a commit to Alexij2/mapsTv that referenced this issue Jan 17, 2023
Small fix bug on php 8.
Sterc#32
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

1 participant