You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been experimenting with the package and found that using nova_page_manager_get_page_by_path with a draft page throws the following when not providing a preview token (so basically a regular user):
[2021-04-3009:42:08] local.ERROR: Trying to access array offset on value of type null
{"userId":1,"exception":"
[object] (ErrorException(code: 0): Trying to access array offset on value of type null at D:\\Projects\\[SNIP]\\vendor\\optimistdigital\\nova-page-manager\\src\\helpers.php:368)[stacktrace]#0 D:\\Projects\\[SNIP]\\vendor\\optimistdigital\\nova-page-manager\\src\\helpers.php(368): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()#1 D:\\Projects\\[SNIP]\\app\\Http\\Controllers\\PageController.php(41): nova_page_manager_get_page_by_path()[SNIP]
"}
The page controller looks like the following:
publicfunctionshow(string$path)
{
$previewToken = request()->input('preview');
$result = nova_page_manager_get_page_by_path($path, $previewToken, 'nl');
// Snip for brevity, validates the existence of $result in addition to other things.// Return the view using data from $result.returnView::first(["pages.{$result->template}", 'pages.fallback'], $data);
}
This seems to occur because $parent cannot be properly found in the nova_page_manager_get_page_by_path helper function. Please feel free to reach out if you need more information!
Instead of it crashing like this, I would expect it to abort with 404 if the page could not be found at all (for regular users so without preview tokens, a draft should not be found at all). Is there some logic beforehand I should be manually checking for? If so, please let me know and update the documentation as I could not find information regarding this specific case. Thanks!
Here's my composer json so you know what versions I'm using. As far as I'm aware, it's the latest versions:
Hey there, great package!
I've been experimenting with the package and found that using
nova_page_manager_get_page_by_path
with a draft page throws the following when not providing a preview token (so basically a regular user):The page controller looks like the following:
This seems to occur because
$parent
cannot be properly found in thenova_page_manager_get_page_by_path
helper function. Please feel free to reach out if you need more information!Instead of it crashing like this, I would expect it to abort with 404 if the page could not be found at all (for regular users so without preview tokens, a draft should not be found at all). Is there some logic beforehand I should be manually checking for? If so, please let me know and update the documentation as I could not find information regarding this specific case. Thanks!
Here's my composer json so you know what versions I'm using. As far as I'm aware, it's the latest versions:
Cheers!
The text was updated successfully, but these errors were encountered: