known icon indicating copy to clipboard operation
known copied to clipboard

Please make known work with PHP version 8

Open pebbe opened this issue 3 years ago • 6 comments

While trying to do this:

./known.php

I encountered this error:

PHP Fatal error:  During inheritance of SessionHandlerInterface: Uncaught ArgumentCountError: Too few arguments to function Idno\Core\Logging::Idno\Core\{closure}(), 4 passed in /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php on line 23 and exactly 5 expected in /var/www/html/blog/Idno/Core/Logging.php:40
Stack trace:
#0 /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php(23): Idno\Core\Logging->Idno\Core\{closure}()
#1 /var/www/html/blog/vendor/composer/ClassLoader.php(444): include('...')
#2 /var/www/html/blog/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile()
#3 /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php(41): Composer\Autoload\ClassLoader->loadClass()
#4 /var/www/html/blog/vendor/composer/ClassLoader.php(444): include('...')
#5 /var/www/html/blog/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile()
#6 /var/www/html/blog/Idno/Data/AbstractSQL.php(87): Composer\Autoload\ClassLoader->loadClass()
#7 /var/www/html/blog/Idno/Core/Session.php(46): Idno\Data\AbstractSQL->handleSession()
#8 /var/www/html/blog/Idno/Common/Component.php(18): Idno\Core\Session->init()
#9 /var/www/html/blog/Idno/Core/Idno.php(117): Idno\Common\Component->__construct()
#10 /var/www/html/blog/Idno/Common/Component.php(18): Idno\Core\Idno->init()
#11 /var/www/html/blog/Idno/Core/Idno.php(45): Idno\Common\Component->__construct()
#12 /var/www/html/blog/known.php(30): Idno\Core\Idno->__construct()
#13 {main} in /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php on line 23

Some other notes:

php version:

PHP 8.1.2 (cli) (built: Jun 13 2022 13:52:54) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Give us some context:

  • It'd also be really handy if you could tell us the contents of your version.known file
version = '1.2.2'
build = 2020061101
revision = "bd43456"
  • What database are you using? (e.g. mongo, mysql, postgres)

mysql

  • Any warnings or errors in your admin/diagnostics page?

Browser gets HTTP ERROR 500

  • If this is a programming bug, can you include examples of any Micropub / API calls / webhook pings you make? Otherwise please don't worry about what this means!
  • Bonus points - are you able to illustrate the issue with a unit test? If so, submit it as a pull request!

pebbe avatar Jun 26 '22 17:06 pebbe

This would be important for me as well. Is this project still actively maintained?

Wunderharke avatar Aug 03 '22 11:08 Wunderharke

Fyi, I've been running known as a personal site instance for a while now with PHP 8.1.8 without encountering much of comparable issues.

Here is the content of my version.known file if that may be of help

version = '1.3.1'
build = 2020120201

thierrymarianne avatar Aug 03 '22 13:08 thierrymarianne

@thierrymarianne thanks for your quick response. My problem is that composer isn't able to install the necessary packages. How did you solve that? Could you share your composer.json?

Wunderharke avatar Aug 03 '22 16:08 Wunderharke

Good day @Wunderharke, ~here is the composer.json~ I'm using:

It's compatible with composer:2.3 Docker container image.

thierrymarianne avatar Aug 04 '22 09:08 thierrymarianne

I didn't get your composer.json working with my version of composer. But I tried the dev branch instead of the latest release tag, and it is working out of the box with composer and PHP 8.

Wunderharke avatar Aug 04 '22 12:08 Wunderharke

Sorry to hear about the incompatibilities between your composer version and this file. Glad to know that something worked eventually.

thierrymarianne avatar Aug 04 '22 19:08 thierrymarianne

We should tag a release, then we can mark this as fixed.

lindner avatar Sep 24 '22 03:09 lindner

Definitely! It would help with issues triaging.

thierrymarianne avatar Sep 25 '22 14:09 thierrymarianne

Please note that I could not reproduce the FatalError mentioned in this issue description by running php known.php with php 8.1.11 as described in https://github.com/idno/known/discussions/3109#discussioncomment-3842599

thierrymarianne avatar Oct 10 '22 20:10 thierrymarianne

Latest version should work on 8 (eg on my site at werd.I’m). We’ll move to a supported release soon. Sorry for the delay!

Ben Werdmuller ( http://goog_1933028737 ) werd.io ( http://werd.io ) | @benwerd ( https://twitter.com/benwerd )

(he/him)

On Sun, Jun 26 2022 at 10:32 AM, Peter Kleiweg < @.*** > wrote:


While trying to do this:

./known.php


I encountered this error:

PHP Fatal error: During inheritance of SessionHandlerInterface: Uncaught ArgumentCountError: Too few arguments to function Idno\Core\Logging::Idno\Core{closure}(), 4 passed in /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php on line 23 and exactly 5 expected in /var/www/html/blog/Idno/Core/Logging.php:40 Stack trace: #0 /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php(23): Idno\Core\Logging->Idno\Core{closure}() #1 /var/www/html/blog/vendor/composer/ClassLoader.php(444): include('...') #2 /var/www/html/blog/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile() #3 /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php(41): Composer\Autoload\ClassLoader->loadClass() #4 /var/www/html/blog/vendor/composer/ClassLoader.php(444): include('...') #5 /var/www/html/blog/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile() #6 /var/www/html/blog/Idno/Data/AbstractSQL.php(87): Composer\Autoload\ClassLoader->loadClass() #7 /var/www/html/blog/Idno/Core/Session.php(46): Idno\Data\AbstractSQL->handleSession() #8 /var/www/html/blog/Idno/Common/Component.php(18): Idno\Core\Session->init() #9 /var/www/html/blog/Idno/Core/Idno.php(117): Idno\Common\Component->__construct() #10 /var/www/html/blog/Idno/Common/Component.php(18): Idno\Core\Idno->init() #11 /var/www/html/blog/Idno/Core/Idno.php(45): Idno\Common\Component->__construct() #12 /var/www/html/blog/known.php(30): Idno\Core\Idno->__construct() #13 {main} in /var/www/html/blog/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php on line 23


Some other notes:

php version:

PHP 8.1.2 (cli) (built: Jun 13 2022 13:52:54) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Give us some context:

  • It'd also be really handy if you could tell us the contents of your version.known file

version = '1.2.2' build = 2020061101 revision = "bd43456"

  • What database are you using? (e.g. mongo, mysql, postgres)

mysql

  • Any warnings or errors in your admin/diagnostics page?

Browser gets HTTP ERROR 500

  • If this is a programming bug, can you include examples of any Micropub / API calls / webhook pings you make? Otherwise please don't worry about what this means!
  • Bonus points - are you able to illustrate the issue with a unit test? If so, submit it as a pull request!

— Reply to this email directly, view it on GitHub ( https://github.com/idno/known/issues/3096 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAEYL2CQMP4CZ5ZK5SSBJHTVRCH4TANCNFSM5Z4IJMDQ ). You are receiving this because you are subscribed to this thread. Message ID: <idno/known/issues/3096 @ github. com>

benwerd avatar Oct 11 '22 07:10 benwerd

Current dev branch works on php 8. Version 1.5 targets 8.1

lindner avatar Nov 28 '22 21:11 lindner

We should tag a release, then we can mark this as fixed.

Hoping that it happens sometime soon!

AmritasyaPutra avatar Jan 26 '23 07:01 AmritasyaPutra

Soon after taking care of https://github.com/idno/known/discussions/3109#discussioncomment-3842599, I've got to say that I got a bit lost in the process of figuring what was the next priority in order to help making the release happen.

Thank you @AmritasyaPutra for reviving the thread.

I wonder which criteria would help us close this issue.🤔

Perhaps, moving the build from travis to GitHub actions and adding PHP 8.1 to the PHP version matrix?

thierrymarianne avatar Jan 26 '23 11:01 thierrymarianne

I just followed the documentation for upgrading and I am now on 1.2.2 and switching to php 8.1 results in 500 Internal Server Error on shared hosting via DreamHost. Any advice?

During inheritance of SessionHandlerInterface: Uncaught ArgumentCountError: Too few arguments to function Idno\Core\Logging::Idno\Core\{closure}(), 4 passed in /home/site/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php on line 23 and exactly 5 expected in /home/site/Idno/Core/Logging.php:40

sikkdays avatar May 10 '23 04:05 sikkdays

I suspect that documentation contains composer instructions so have you ran composer install or if that doesn't work composer update? A release would bundle all those project dependencies so that using composer wouldn't be required. (making a few assumptions here)

svandragt avatar May 10 '23 09:05 svandragt

This has gone on for long enough. I commit to a new release on June 1.

However, for now: the core code in GitHub is fully tested on PHP 8.1.1. I'll make an effort to test on PHP 8.2 before release.

benwerd avatar May 10 '23 16:05 benwerd

Thanks @benwerd ! Much appreciated.

@svandragt On the shared DreamHost account, install and upgrade of Known was always just dropping the files and folders on the server. I do have limited ssh access, so I can try the composer update and see if that helps. Upgrading to the developer version (1.3.1) got me a shiny new error--

Idno/Core/DataConcierge.php:184 - "Uncaught Error: Class "Ramsey\Uuid\Uuid" not found

I think you're correct that composer may be the issue here. Now, I just need to find some more evening time to try and update it.

sikkdays avatar May 12 '23 05:05 sikkdays

👋🏻

FYI, I've been running known with PHP 8.2.6 without issues - so far 🤞🏻 Besides, the application health is monitored with an APM generating regularly synthetic tests so that errors are not left unchecked for too long whenever a runtime upgrade happened before, new features or plugins have been rolled out.

Diagnostics also seems to be fine with it: diag

P.S. If some are interested about how to run an known instance with Docker Compose (v2), guidelines for the documentation with code snipped could most likely be drafted at some point. I've got something working with nginx, mysql and taking care of building the assets (with grunt) and installing the vendors (with composer)

thierrymarianne avatar May 21 '23 15:05 thierrymarianne

It does work on PHP 8.2; therefore, I'm closing this issue.

benwerd avatar Oct 23 '23 21:10 benwerd