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

Error: During inheritance of Countable: Uncaught Whoops\Exception\ErrorException: Return type of Twig\Node\Node::count() should either be compatible with Countable::count() #3088

Open
csbalazs opened this issue Oct 18, 2022 · 8 comments

Comments

@csbalazs
Copy link

csbalazs commented Oct 18, 2022

  1. I installed clean Joomla 4.2.3 under Wampserver (3.2.9), PHP 8.1.11
  2. I installed latest CI build (Gantry 5.5.16-dev-8885f9f4e) and Helium template (5.5.16-dev-8885f9f4e)
  3. I set default template to Helium, and got the following error (under Error Reporting of Joomla!: System Default):

Error: During inheritance of Countable: Uncaught Whoops\Exception\ErrorException: Return type of Twig\Node\Node::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\wamp64\www\joomla4\libraries\gantry5\compat\vendor\twig\twig\src\Node\Node.php:213 Stack trace: # 0 C:\wamp64\www\joomla4\libraries\gantry5\src\classes\Gantry\Component\Whoops\SystemFacade.php(119): Whoops\Run->handleError(8192, 'Return type of ...', 'C:\wamp64\www\j...', 213) # 1 C:\wamp64\www\joomla4\libraries\gantry5\compat\vendor\twig\twig\src\Node\Node.php(23): Gantry\Component\Whoops\SystemFacade->handleError(8192, 'Return type of ...', 'C:\wamp64\www\j...', 213) # 2 C:\wamp64\www\joomla4\libraries\vendor\composer\ClassLoader.php(571): include('C:\wamp64\www\j...') # 3

Helium template works under PHP version 8.0.13.

image

@bascherz
Copy link

bascherz commented Dec 3, 2022

I am getting this same error with two sites, one each running Hydrogen 5.5.14 and Helium 5.5.14 on Joomla! 4.2.5. I have one other site running the same version of Helium 5.5.15 that does NOT do this. So I upgraded the other two sites to 5.5.15 and it did not resolve this issue. But upgrading the Gantry package to 5.5.15 DID.

@bascherz
Copy link

After upgrading to Gantry 5.5.15 on all my sites, I can no longer use the administrator menu layout manager. That's kind of a big deal, though nowhere nearly as bad as the front end fatal errors. I get this error for every menu on all of my sites using Gantry 5.5.15.

image

@N8Solutions
Copy link

@bascherz since this is a new problem, please open a different issue for this so it can be properly tracked.

@bascherz
Copy link

It seems the issue has been reported elsewhere (#3073), but similar to my posting is intermixed with other issues and this part seems to be getting overlooked/ignored.

I am happy to create a new issue for it, though.

@N8Solutions
Copy link

N8Solutions commented Dec 18, 2022

I would just comment on the other one rather than open a new issue.
P.S. I'm just a volunteer/user like yourself but try to help out when I can.

@bascherz
Copy link

bascherz commented Dec 18, 2022

Already created a new issue (#3103). I really like how this forum ties all these issues together when they are cited by link reference.

@csbalazs
Copy link
Author

csbalazs commented Jan 30, 2023

I checked the source code and the Twig version (v1) used by Gantry is no longer supported under PHP 8.1.
Temporary solution, download the version v2 of Twig and replace the version v1:

  1. Go to https://github.com/twigphp/Twig/tree/2.x
  2. Click the (green) Code button, then the Download ZIP link
  3. Go to \libraries\gantry5\compat\vendor\twig\twig and rename or delete the last twig folder
  4. Extract the contents of the downloaded ZIP file to the \libraries\gantry5\compat\vendor\twig\twig folder
  5. After that, the page will also work under the Error Reporting of Joomla!: System Default setting

@galvani66
Copy link

The solution suggested by csbalazs solved the problem for me.
Bei mir hat der Lösungsvorschlag von csbalazs das Problem gelöst.

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

4 participants