Migration 1.5 to 1.6 - fatal error

Hi,

I’m moving my installation of IP from an old server (with 1.5, PHP 7) to a new one (with 1.6, PHP 8.1). Database has been migrated, folder has been copied, instructions on Update InvoicePlane - InvoicePlane Wiki followed. When loading the setup page, I get:

Fatal error: Declaration of CI_SessionWrapper::open(string $save_path, string $name): bool must be compatible with SessionHandlerInterface::open($save_path, $name) in /srv/www/mysite/vendor/codeigniter/framework/system/libraries/Session/PHP8SessionWrapper.php on line 59

Not sure what to do with that - I’m not exactly good at PHP. I read some things online about telling things to expect changed types, but I don’t feel overly comfortable with touching CodeIgniter files.

Full message:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /srv/www/mysite/vendor/codeigniter/framework/system/libraries/Session/PHP8SessionWrapper.php:50)

Filename: core/Common.php

Line Number: 571

Backtrace:

A PHP Error was encountered

Severity: Compile Error

Message: Declaration of CI_SessionWrapper::open(string $save_path, string $name): bool must be compatible with SessionHandlerInterface::open($save_path, $name)

Filename: Session/PHP8SessionWrapper.php

Line Number: 59

Backtrace:

1 Like

That’s a very weird error.
Do me a favor:

  • Install a completely new InvoicePlane v1.6.1 on that new server, grab the .zip from the invoiceplane.com website or from the github 'releases page (they’re the same)
  • Empty database
  • make sure that it works first

Also: make sure the new server has PHP version 8.1, not 8.2

1 Like

Thanks for the quick reply.

I created a new database and db user, new vhost with freshly unzipped 1.6.1, bare minimum settings in ipconfig.php. Exact same error in the exact same files/lines when visiting https://url/setup.

$ php --version
PHP 8.1.29 (cli) (built: Aug 8 2024 02:13:45) (NTS)

This is on FreeBSD 14.1-RELEASE, php-fpm, nginx, mysql. I didn’t mess with php’s default settings except setting the UNIX socket + perms and cgi.fix_pathinfo=0 (I don’t remember what it was for, only that I documented it on my old machine that it was required on the old vhost).

1 Like

I’m trying to wrap my head around why this…

59 public function open(string $save_path, string $name): bool

… would not be compatible with this…

41 /**
42 * SessionHandlerInterface
43 *
44 * PHP 5.4 compatibility interface
51 */
52 interface SessionHandlerInterface {
53
54 public function open($save_path, $name);

… and also why on EARTH we still need PHP 5.4 compatibility interfaces. But okay. :joy:

1 Like

Update on this: the issue is that php no longer (?) likes that an interface does not explicitly declare the types of the arguments in the function definitions.

If in SessionHandlerInterface I change:

public function open($save_path, $name);

into:

public function open(string $save_path, string $name);

The error goes away. But of course it then barfs on the very next function. I don’t feel like rewriting every single interface to be specific.

I don’t know PHP well enough, but… is there a setting to stop it from being so anal about this? I mean, besides the fact that I never understood the concept of creating an interface without specifying the types, but that’s a whole other discussion.

Well, here we are. It appears that the problem is that php-session wasn’t installed. Onwards to the next step.

Oh, and php-filter as well.

Maybe something to add to the requirements web page (for FreeBSD specific, perhaps, since apparently Linux usually bundles and enables those by default) :smile:

2 Likes

Hi @LVA thank you for the hint. Will double check the dependencies and update the requirements accordingly.

1 Like