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

Grav v1.6.21 breaks on PHP 7.4? (E_NOTICE - Trying to access array offset on value of type null) #2832

Closed
ulfben opened this issue Feb 20, 2020 · 13 comments

Comments

@ulfben
Copy link

ulfben commented Feb 20, 2020

I'm running Grav v1.6.21 on Ubuntu 18.04. After upgrading PHP to 7.4.3 the site broke - when loading the front page I get:

E_NOTICE - Trying to access array offset on value of type null

The log says:
[2020-02-20 21:51:58] grav.CRITICAL: Trying to access array offset on value of type null - Trace:
#0 /var/www/infoscreen/system/src/Grav/Common/Debugger.php(352): Whoops\Run->handleError()
#1 /var/www/infoscreen/vendor/erusev/parsedown-extra/ParsedownExtra.php(241): Grav\Common\Debugger->deprecatedErrorHandler()
#2 /var/www/infoscreen/vendor/erusev/parsedown/Parsedown.php(206): ParsedownExtra->blockSetextHeader()
#3 /var/www/infoscreen/vendor/erusev/parsedown/Parsedown.php(39): Parsedown->lines()
#4 /var/www/infoscreen/vendor/erusev/parsedown-extra/ParsedownExtra.php(46): Parsedown->text()
#5 /var/www/infoscreen/system/src/Grav/Common/Page/Page.php(849): ParsedownExtra->text()
#6 /var/www/infoscreen/system/src/Grav/Common/Page/Page.php(692): Grav\Common\Page\Page->processMarkdown()
#7 /var/www/infoscreen/system/src/Grav/Common/Twig/Twig.php(366): Grav\Common\Page\Page->content()
#8 /var/www/infoscreen/system/src/Grav/Common/Service/OutputServiceProvider.php(28): Grav\Common\Twig\Twig->processSite()
#9 /var/www/infoscreen/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\OutputServiceProvider->Grav\Common\Service{closure}()
#10 /var/www/infoscreen/system/src/Grav/Common/Processors/RenderProcessor.php(28): Pimple\Container->offsetGet()
#11 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\RenderProcessor->process()
#12 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#13 /var/www/infoscreen/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php(28): Grav\Framework\RequestHandler\RequestHandler->handle()
#14 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\DebuggerAssetsProcessor->process()
#15 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#16 /var/www/infoscreen/system/src/Grav/Common/Processors/PagesProcessor.php(69): Grav\Framework\RequestHandler\RequestHandler->handle()
#17 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\PagesProcessor->process()
#18 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#19 /var/www/infoscreen/system/src/Grav/Common/Processors/TwigProcessor.php(27): Grav\Framework\RequestHandler\RequestHandler->handle()
#20 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\TwigProcessor->process()
#21 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#22 /var/www/infoscreen/system/src/Grav/Common/Processors/AssetsProcessor.php(28): Grav\Framework\RequestHandler\RequestHandler->handle()
#23 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\AssetsProcessor->process()
#24 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#25 /var/www/infoscreen/system/src/Grav/Common/Processors/SchedulerProcessor.php(29): Grav\Framework\RequestHandler\RequestHandler->handle()
#26 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\SchedulerProcessor->process()
#27 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#28 /var/www/infoscreen/system/src/Grav/Common/Processors/BackupsProcessor.php(28): Grav\Framework\RequestHandler\RequestHandler->handle()
#29 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\BackupsProcessor->process()
#30 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#31 /var/www/infoscreen/system/src/Grav/Common/Processors/TasksProcessor.php(59): Grav\Framework\RequestHandler\RequestHandler->handle()
#32 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\TasksProcessor->process()
#33 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#34 /var/www/infoscreen/system/src/Grav/Common/Processors/RequestProcessor.php(52): Grav\Framework\RequestHandler\RequestHandler->handle()
#35 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\RequestProcessor->process()
#36 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#37 /var/www/infoscreen/system/src/Grav/Common/Processors/ThemesProcessor.php(27): Grav\Framework\RequestHandler\RequestHandler->handle()
#38 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\ThemesProcessor->process()
#39 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#40 /var/www/infoscreen/system/src/Grav/Common/Processors/PluginsProcessor.php(30): Grav\Framework\RequestHandler\RequestHandler->handle()
#41 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\PluginsProcessor->process()
#42 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#43 /var/www/infoscreen/system/src/Grav/Common/Processors/InitializeProcessor.php(95): Grav\Framework\RequestHandler\RequestHandler->handle()
#44 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\InitializeProcessor->process()
#45 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#46 /var/www/infoscreen/system/src/Grav/Common/Processors/DebuggerProcessor.php(27): Grav\Framework\RequestHandler\RequestHandler->handle()
#47 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\DebuggerProcessor->process()
#48 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#49 /var/www/infoscreen/system/src/Grav/Common/Processors/ErrorsProcessor.php(27): Grav\Framework\RequestHandler\RequestHandler->handle()
#50 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\ErrorsProcessor->process()
#51 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#52 /var/www/infoscreen/system/src/Grav/Common/Processors/LoggerProcessor.php(48): Grav\Framework\RequestHandler\RequestHandler->handle()
#53 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\LoggerProcessor->process()
#54 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#55 /var/www/infoscreen/system/src/Grav/Common/Processors/ConfigurationProcessor.php(28): Grav\Framework\RequestHandler\RequestHandler->handle()
#56 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\ConfigurationProcessor->process()
#57 /var/www/infoscreen/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle()
#58 /var/www/infoscreen/system/src/Grav/Common/Grav.php(272): Grav\Framework\RequestHandler\RequestHandler->handle()
#59 /var/www/infoscreen/index.php(54): Grav\Common\Grav->process()
#60 {main} [] []

All plugins are up-to-date, and I've tried disabling them all but the problem persist.

Is this an issue on my end, and if so, how do I trouble-shoot?

@ulfben
Copy link
Author

ulfben commented Feb 21, 2020

Downgrading to php7.3 solved the issue, so that's what I'll do for now. I wrote a guide on the support forum for anyone else that might have to do this.

@llamaret
Copy link

The same thing happened to me and I had to go back in the PHP version. But I would like to have the VPS with PHP 7.4 and I can't do it just because of this Grav error. Will the solution come soon?

@mahagr
Copy link
Member

mahagr commented Feb 24, 2020

This error actually happens because we're using an older version of Parsedown (using the newest version also breaks some sites, so it has only been added to Grav 1.7). Please try out Grav 1.7 (RCs), it should fix this issue.

Grav 1.7 is not stable yet; any help on testing it out and finding the last bugs is more than welcome. Just avoid using it in the production sites for now. :)

@oliver32767
Copy link

oliver32767 commented Mar 5, 2020

Still an issue in the latest RC 6 on php 7.4.3

@rhukster
Copy link
Member

rhukster commented Mar 5, 2020

Looks like an issue with parsedown extra. I’ll see if there are any more updates available.

@rhukster
Copy link
Member

rhukster commented Mar 6, 2020

Ok, this is because we're kinda stuck on Parsedown 1.6 which means we're also stuck with the old Parsedown Extra library. If we upgrade this to 1.7, then it breaks a whole bunch of markdown plugins. It's not something we can just do carelessly, as it could take existing sites down with nasty errors.

We're investigating the possibility of 'hot-loading' the old or the newer Parsedown/Parsedown-Extra libraries based on a config toggle. So you can optionally upgrade to the newer version. It's a bit tricky though.

@paulhibbitts
Copy link

paulhibbitts commented Mar 6, 2020

Hi @rhukster , not sure if this is related but this was an error message seen by a Open Course Hub user re: Shortcodes Plugin (?) which went away when they switched from PHP 7.4 to PHP 7.3:

unknown

Please let me know if I should open a new issue on the Shortcodes Plugin repo.

Thanks very much,
Paul

@mahagr
Copy link
Member

mahagr commented Mar 9, 2020

@paulhibbitts Above is also fixed in Grav 1.7 and was not related to the shordcodes plugin.

@paulhibbitts
Copy link

Thanks for the update @mahagr , I will try to test more re: Shortcode Plugin and PHP 7.4.

@rhukster
Copy link
Member

Fixed in Develop branch by moving Parsedown 1.6 /ParsedownExtra 0.7 into Grav\Framework and back-porting PHP 7.4 fixes.

@karfau
Copy link

karfau commented Jun 24, 2022

@rhukster (or anybody else) I know it has been a while, but:

I'm stuck on a very old grav version (1.3.10) and there is no way for me to upgrade easily (I already tried it once in 2018 and failed).

Does anybody have a hint for me how I could backport those fixes to that version, so I'm able to run that version on php 7.4?

Never mind: 7.4 will already be EOL in November 2022, so I assume it's not worth the effort.
image

Goodby grav, it was a nice time between 2017 and 2022.

@rhukster
Copy link
Member

there is no other way unless you upgrade Grav. php makes changes in their releases and those require code changes on our part and in 3rd party vendor libraries we use. the only way for us to do this is to release a new version of Grav that can then support the new changes in Php. our current version of Grav 1.7.34 supports the latest php 8.1 release but we’ll probably need to release grav 1.8 to support the upcoming php 8.2 as some things are deprecated and won’t work with current code.

if upgrading the code is beyond your skill set, you can contact us via trilbymedia.com for a quote.

@karfau
Copy link

karfau commented Jun 24, 2022

I think the way I have customized stuff and since it's really hard to know all the things that would need changes between versions makes it quite hard.
But thanks for the offer.

Will consider it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants