getgrav / grav-premium-issues

Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered.
https://getgrav.org/premium
7 stars 2 forks source link

[seo-magic] Current Pages inaccessible via admin after install #457

Open blizam opened 1 month ago

blizam commented 1 month ago

After installing SEO Magic and generating SEO data on a new environment I was provided with (that I'm unsure of the setup for... I did switch between PHP 7.4 and 8.3; no difference and verified all PHP modules are installed) I ran into the following error when trying to access any exiting Page via the admin OR creating any new Page (and then regenerating SEO data):

Error: preg_replace(): Unknown modifier '~'

image image

When creating a new page: with admin functions disabled after initially saving the page the SEO magic tab would always have the red banner that says "SEO Magic Data has not been generated for this page, click Save to generate." but the page would remain accessible... you could save+close, go to another page, come back... still no SEO data/red banner, but page is accessible. After then regenerating data forcefuylly/manually from the plugin settings button (or by having admin function enabled on initial save) the page becomes inaccessible with the same error.

I was able to get around this error by:

1) Changing the Page Title of every page via the page's yaml file (FTP/SSH) (maybe touching the file would've been enough?) 2) Regenerating SEO data from the plugin's admin

create new page > forcefully rengerate seo data (admin page breaks) >edit the page's title via the yaml file > regenerate seo data again (admin page is accessible)

something with existing pages and new pages not have/getting SEO data generated that fails when it's force to generate for the first time but succeeds when the page is modified (via yaml since admin is inaccessible) and data is forcefully generated a 2nd time

I tried disabling the Grav cache entirely to no effect, so seems like it's something specific with SEO Magic's data for existing and brand new pages.... but once the page is edited manually via the yaml file and SEO data is generated again, the page is accessible.

I have not run into this issue on other environments... which are likely running an older SEO Magic... I'll go test those, and upgrade + test when I have some time.

rhukster commented 1 month ago

This is strange, never seen this error here before. Can you send me a copy of the page's .md file so I can see if I can recreate it?

blizam commented 1 month ago

It's pretty basic:

---
title: 'New Test Page'
sitemap:
    lastmod: '20-07-2024 17:52'
---

1) With admin actions off create a new page, page saves successfully (with above YAML), and SEO Magic tab has red banner saying SEO data was not generated 2) Click the icon to regenerate all SEO data 3) Try to access page in the admin again and get the error

You can skip steps 2 and 3 with admin actions on, it'll go straight to the error on save and it will still actually create the page

Then, if I just change the YAML (title) ever so slighty:

---
title: 'New Test Page 2'
sitemap:
    lastmod: '20-07-2024 17:52'
---

And regenerate SEO data with the icon (if I don't do this, it still errors), everything is fine.

PHP Version 8.3.8 (tested on 7.4 as well) Server API | LiteSpeed V8.1 Cloudlinux 1.3 Virtual Directory Support | disabled

blizam commented 1 month ago

It's something with the Flex Objects plugin... or probably more aptly it's to-do with the extra stuff the Flex Objects plugin enables in the Admin... like the Pages Search and more advanced Pages admin... notably when I Save a new Page SEO magic thinks it's not published (even though it shows Published)... I dunno... Maybe SEO Magic doesn't work at all without Flex Objects? If I disable the Flex Objects plugin I don't encounter the error any more... but maybe that's just a red herring if it effectively disables SEO Magic