mayamcdougall / freelancer-pico

A Pico port of Freelancer by Start Bootstrap.
MIT License
11 stars 7 forks source link

Clean installation giving fatal error #13

Open suzieq-1 opened 10 months ago

suzieq-1 commented 10 months ago

`[error] 403865#403865: *116930 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in /var/www/xxx/pico/vendor/symfony/yaml/Parser.php:532 Stack trace:

0 /var/www/xxx/pico/vendor/symfony/yaml/Parser.php(532): abs()

1 /var/www/xxx/pico/vendor/symfony/yaml/Parser.php(258): Symfony\Component\Yaml\Parser->parseValue()

2 /var/www/xxx/pico/vendor/symfony/yaml/Parser.php(320): Symfony\Component\Yaml\Parser->doParse()

3 /var/www/xxx/pico/vendor/symfony/yaml/Parser.php(246): Symfony\Component\Yaml\Parser->parseBlock()

4 /var/www/xxxx/pico/vendor/symfony/yaml/Parser.php(320): Symfony\Component\Yaml\Parser->doParse()

5 /var/www/xxx/pico/vendor/symfony/yaml/Parser.php(246): Symfony\Component\Yaml\Parser->parseBlock()

`

Latest version of Pico. PHP version: 8.2.7

mayamcdougall commented 10 months ago

Hi there. 👋🏻

Did your installation work with the Default theme, before you tried Freelancer?

Given that the "Stable" version of Pico isn't compatible with PHP 8.0+, that'd be my first assumption. 🤔

I don't really do anything with numbers in this theme, so I'm not sure at a glance what the cause of the issue would be.

The stack trace there seems to indicate that somewhere in its parsing of YAML data (page metadata, or possibly Pico's config.yml, I'm not sure), it encountered a String instead of a number. It then tried to get the absolute value (abs()) of that not-a-number (or likely, a number in quotes, making it a String).

But, since this is happening during the Parsing of YAML, this shouldn't be an issue with Freelancer, as far as I know, it's happing before the Theme is actually being processed.


As far as the 8.0+ compatibility issue, there's a note in the Readme right now about it. https://github.com/picocms/Pico/tree/master#php-80-users

Basically, there's a link you can download ("Pre-Bundled Release" in that paragraph) of Pico but with updated dependencies that allow it to run on PHP 8.0+.

Unfortunately, Pico's been on life-support for quite a while, and the main developer doesn't seem to have the time to properly update it. The "pre-release" version is just updated dependencies, and otherwise identical to the Stable branch. Updating the dependencies does have some minor compatibility issues (specifically with older themes), so he's been reluctant to release it as anything but "3.0".

Since PHP 7 is long since end-of-life, that puts Pico in a very rough spot right now, and I'm not sure when/if it's going to get better.

If you're not running the pre-release version, give it a shot and see if that helps.

If you're already running it and you're still having this error, then I'm not sure what the issue is without further investigation, but I'll try to help you narrow it down if I can. 😅

suzieq-1 commented 10 months ago

Hi @mayamcdougall Thank you for you detailed answer, very helpfull. It worked right away with the default theme, just not with the freelancer-pico one. I assume it's a combination of the theme, PHP8 and the current state of Pico. For me you can close this case since i moved on to a different solution, but it might break for others in the future.

Suzie

mayamcdougall commented 10 months ago

Oof. I'm sorry it didn't work out for you. 😔

I'll leave this open for now in case anyone else has a similar issue.

I just tried reproducing this issue, with a clean Pico install and a clean Freelancer too. I tried using the latest PHP and 8.2.7, and everything just worked fine for me.

Web servers are weird sometimes though, and I'm not confident in saying it couldn't just be some weird quirk with how PHP is configured slightly differently on your server, or something. 🤷🏻‍♀️

Let me know if you change your mind and I'll still try and help out.

At the moment though, I've got no idea what the cause of this was. 😓

Good luck with your new solution. 🤞🏻

frozenade commented 9 months ago

Yes it's not work for me too:

Fatal error: Uncaught TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php:532 Stack trace: #0 /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php(532): abs() #1 /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php(258): Symfony\Component\Yaml\Parser->parseValue() #2 /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php(320): Symfony\Component\Yaml\Parser->doParse() #3 /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php(246): Symfony\Component\Yaml\Parser->parseBlock() #4 /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php(320): Symfony\Component\Yaml\Parser->doParse() #5 /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php(246): Symfony\Component\Yaml\Parser->parseBlock() #6 /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php(78): Symfony\Component\Yaml\Parser->doParse() #7 /home/sarjanak/public_html/vendor/picocms/pico/lib/Pico.php(1093): Symfony\Component\Yaml\Parser->parse() #8 /home/sarjanak/public_html/vendor/picocms/pico/lib/Pico.php(441): Pico->loadTheme() #9 /home/sarjanak/public_html/index.php(39): Pico->run() #10 {main} thrown in /home/sarjanak/public_html/vendor/symfony/yaml/Parser.php on line 532

I'm using the latest current version of both Pico and Freelancer with PHP 8.1