picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.83k stars 617 forks source link

Warning : Wrong parameter count for class_alias() in... #421

Closed Petemcp closed 6 years ago

Petemcp commented 6 years ago

Hi,

I'm getting loads of these errors when I move pico from my local server to my remote server...

Warning : Wrong parameter count for class_alias() in public_html/p16/vendor/twig/twig/lib/Twig/LoaderInterface.php on line 57

My web host is running PHP 5.6.24 My localhost is running PHP 5.4.24

What could cause an error like this to occur in every file in the Twig folder? Unfortunately, searching for the term mostly shows other people's site that have the same problem and something suggesting upgrading PHP - which seems to be contradicted by my earlier version working and newer one not...

Maybe worth mentioning that this occurs with both 1.0.6 and 2.0

Any support or suggestions where to start would be really appreciated, thank you.

Pete

PhrozenByte commented 6 years ago

This is indeed a issue caused by a bug in your PHP installation, likely even caused by some distribution-specific or hoster-specific patches applied to your PHP build (because I can't find a single broken PHP version, see https://3v4l.org/v0Od9).

The only "real" solution here is to upgrade to a fixed PHP version. Working around this issue by removing the third argument of all class_alias() calls might be a temporary solution (however I'd never recommend you to do this yourself (see below); nevertheless you might want to use some search & replace rather than doing this manually).

Please note that Pico itself doesn't use class_alias(), it is used by Twig, the template engine Pico uses (a "upstream project"). Thus working around this is out of our control. I'd recommend you to open a new Issue on https://github.com/twigphp/Twig and ask them whether they can remove the third argument of their class_alias() calls. This shouldn't make any difference (because the class is defined right before the class_alias() call, so PHP won't try to autoload anything anyway), but please be aware that this is not a bug in Twig (i.e. they aren't doing anything wrong). Pico v2.0.0-beta.2 uses Twig v1.35.0.

Petemcp commented 6 years ago

Thanks for the really quick and clear response. I'll try nudging my host to see if it's something they can tweak before I go down the route of hassling twig Devs or embarking on a collosal find and replace nightmare.