gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.03k stars 204 forks source link

[Joomla] Gantry 5 and integrating phpBB with p8pbb = login issues and Twig errors thrown #2656

Open Uncommonly opened 4 years ago

Uncommonly commented 4 years ago

Everything between Gantry and p8pbb work flawless until when someone wants to login into their profile from Joomla side ( using login menu/page from phpBB is OK ). I got the follwing error when logged in:

Fatal error: Uncaught TypeError: Argument 1 passed to Whoops\Handler\PrettyPageHandler::masked() must be of the type array, object given, called in /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php on line 241 and defined in /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php:717 Stack trace: #0 /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php(241): Whoops\Handler\PrettyPageHandler->masked(Object(phpbb\request\deactivated_super_global), '_GET') #1 /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Run.php(321): Whoops\Handler\PrettyPageHandler->handle(Object(TypeError)) #2 /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/classes/Gantry/Component/Whoops/SystemFacade.php(132): Whoops\Run->handleException(Object(TypeError)) #3 [internal function]: Gantry\C in /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php on line 717

Fatal error: Uncaught TypeError: Argument 1 passed to Whoops\Handler\PrettyPageHandler::masked() must be of the type array, object given, called in /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php on line 241 and defined in /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php:717 Stack trace: #0 /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php(241): Whoops\Handler\PrettyPageHandler->masked(Object(phpbb\request\deactivated_super_global), '_GET') #1 /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Run.php(321): Whoops\Handler\PrettyPageHandler->handle(Object(Whoops\Exception\ErrorException)) #2 /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Run.php(403): Whoops\Run->handleException(Object(Whoops\Exception\ErrorException)) in /xxx/xxx/xxx/xxx/xxx/libraries/gantry5/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php on line 717

After refresh on the page web site returns "Warning. The security token did not match. The request was aborted to prevent any security breach. Please try again.".. in addition :)

And also the following when tryed to access forum page:

Screenshot_2020-06-03 Crikey There was an error

Regarding to the developers of p8pbb, it's Gantry issue because it's using older Twig version than phpBB which is using newer.

mahagr commented 4 years ago

You can remove the Twig version from Gantry and it should just work (you may need 5.5 branch if the main release has issues), please contact me if it doesn't work.

However, the themes may need some minor tweaks in their twig in order to make them work, though the changes are really minor and easy to do.

Uncommonly commented 4 years ago

No idea how to do that. Could you be more specific please? I’m using latest Gantry version with Reiko. Thanks.

mahagr commented 4 years ago

Delete or rename folder libraries/gantry5/vendor/twig.

I know I've fixed all the compatibility issues with future Twig versions, but as I said, I don't know if those changes have been released or not. Let's try it out.

Uncommonly commented 4 years ago

That didn't work at all. Same errors on forum page and blank page everywhere else.

mahagr commented 4 years ago

I'm on a vacation for 2 weeks with no possibility to test this one right now.

Uncommonly commented 4 years ago

Will have to wait you until you get back then. Enjoy your holiday. :)

Uncommonly commented 4 years ago

Bump.

Uncommonly commented 4 years ago

Any movement here?

mahagr commented 4 years ago

Sorry for the delay. I was finally able to verify this bug. Gantry uses Twig 1 where the latest phpBB3 versions use Twig 2.

In Gantry HtmlDocument::escape() method relies on Twig 1 methods, which do not exist in Twig 2 anymore.

mahagr commented 4 years ago

@Uncommonly @Kerveros Please test if installing CI version from the Gantry site + deleting vendor/twig again solves the issue.

Uncommonly commented 4 years ago

No, it doesn't fix the problem. The only fix that applies to this is manually updating twig in Gantry which doesn't really solve the issue, because on every update that is released after, just rolls back the old twig in Gantry. Just include latest twig in next Gantry update, please?

mahagr commented 4 years ago

Oh, I forgot to say that you'd still need to remove twig from the vendor folder.

Unfortunately, I cannot update the Twig version without version bump and a big warning because it breaks a lot of sites. Twig 2 also requires PHP 7.1 and Gantry has still way too many sites running on older versions.

Uncommonly commented 4 years ago

PHP 5 in 2020? Cmon guys :>

Attaching manually updated twig. That's the only way to get working both Gantry and p8pbb. Works without any issues for about month now.

gantry5_new.zip

mahagr commented 4 years ago

Yea... I know. If it was my choice, I would only support PHP 7.3 or later. We are going to ramp up the version to 5.6.20 soon, as it is the minimum requirement for WP. I just wish Joomla would do the same, it's still supporting PHP 5.3.10!

The best way to support phpBB with Gantry would be to ensure that only a single version of Twig is being loaded. This means removing the folder from the vendor or doing some tricks in the autoloader to omit twig when p8pbb (or something else using twig) is active.

Can you test what happens if you just remove the folder? Does it break Gantry somewhere or does p8pbb autoload twig all the time?

Uncommonly commented 4 years ago

No changes when folder being deleted. Same errors being thrown away.

mahagr commented 4 years ago

Did you mean that there are errors with folder deleted? And no errors when you use twig 2?

Uncommonly commented 4 years ago

Yes mate. :)

mahagr commented 4 years ago

Hmm, OK. So it looks like PhpBB loads Twig only when you're using the forum. Thanks for the info!

rogernclarke commented 3 years ago

I have the same problem as well. Replacing Twig 1 with Twig 2 in gantry5 library has fixed it, but I will have to reapply this every time I update Gantry?

Uncommonly commented 3 years ago

Up. 8 months later, Twig in Gantry is still out of date -.-

bjornclaesgithub commented 3 years ago

I hear that Gantry 5.6 is in the making with minimum PHP 7.2 requirement (https://github.com/gantry/gantry5/issues/2789). Does this mean we can foresee a Twig2 integration then too which eliminates this problem for good? Meaning automatic updates running and no more CSS issues when using the p8pbb bridge?

mahagr commented 3 years ago

Yeah, I have already added some logic to allow to switch between Twig versions. I may need to do the same for Twig 1/2 as some of the old themes may not work without changes in Twig 2, we could at least have the option to choose which one to use.

bjornclaesgithub commented 3 years ago

If the option would exist, that would be enough I suppose. Any timings on this release? I know, this is most of the time the forbidden question. But just roughly speaking. This year or 2022.

mahagr commented 3 years ago

You have to remember that Twig 1 is still maintained and receives all the fixes. Also, there's already Twig 3, too.

bjornclaesgithub commented 3 years ago

1) Twig 1: indeed. No problem or issues there if the option to choose is there. 2) Indeed yes. But that would be a bridge too far now since both Joomla en the p8pbb plugin still uses Twig 2 now. I don't know which version of Twig will be used in Joomla 4, but if this is going to be Twig 3 then I'm quite certain the p8pbb plugin will follow suite quite quickly.

bjornclaesgithub commented 1 year ago

More then a year has gone by and just wanted to know what's the situation now, since I've seen an update in p8pbb stating that compatibility with Gantry5 was 'solved'.