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

PHP8.1 compatibility #831

Merged
merged 14 commits into from
Oct 16, 2022
Merged

Conversation

vtq221
Copy link
Contributor

@vtq221 vtq221 commented Jul 25, 2022

PHP8.1 compatibility changes - see #798

https://php.watch/versions/8.1

Testing progress against PHP8.1

  • phpcompatibility/php-compatibility code scan for errors
  • Core functionality (login, session, view render, save form data, nav menu)
  • Modules: clients, quotes, invoices, payments products, tasks, reports
  • PDF creation
  • Email
  • System settings
  • Recurring invoices / cron
  • Create user
  • Custom fields

Pull Request Checklist

  • My code follows the code formatting guidelines.
  • I have an issue ID for this pull request.
  • I selected the corresponding branch.
  • I have rebased my changes on top of the corresponding branch.

Issue Type (Please check one or more)

  • Bugfix
  • Improvement of an existing Feature
  • New Feature
  • Compatibility with new software

@nielsdrost7 nielsdrost7 changed the title Development PHP8.1 compatibility Jul 25, 2022
@nielsdrost7 nielsdrost7 mentioned this pull request Aug 12, 2022
@onny
Copy link

onny commented Sep 2, 2022

Is a new offical release with PHP8 support planned any time soon? Looking forward to it otherwise we'll have to drop Invoiceplane from NixOS :,(

@clockwiseq
Copy link
Contributor

Is a new offical release with PHP8 support planned any time soon? Looking forward to it otherwise we'll have to drop Invoiceplane from NixOS :,(

Although we do not have a schedule or a date just yet, we are planning on releasing a new version that is compatible with PHP8 and we plan on staying compatible with the latest PHP releases going forward. I know that doesn't really answer your question, but at least letting you know that we do plan on releasing a new version, just not scheduled yet.

@nielsdrost7
Copy link
Contributor

@onny thank you for your question.

This PR is that PHP 8.1 compatible version.
We can release it any time, but we're waiting for a tactically right time.

@WalleBE
Copy link

WalleBE commented Sep 26, 2022

Hi, is it safe to use this version? My provider is stopping php 7.4 support.
I'm happy to test.

@vtq221
Copy link
Contributor Author

vtq221 commented Sep 27, 2022

Hi there,

Testing would be great if you can take a look. Based on my testing it's working well but it would be good to get some more testers - I should have time to fix any specific issues identified. I don't have time right now to do thorough testing myself.

The only exception is online payments - I haven't had time to implement online payments for PHP8. It could take some time.

I'll do my best to resolves issues identified by testers, but unfortunately I've been very busy lately so haven't been able to thoroughly test myself. I've been using this version myself with no issues for several months.

If anyone needs online payments, maybe post which provider you use. Without more help, I won't be able to implement all the current supported payment providers.

@WalleBE
Copy link

WalleBE commented Sep 27, 2022

Hi, I'm not using payments functions, I'll test standard function as deep as possible :-)

@nielsdrost7
Copy link
Contributor

Thanks guys, really appreciate it!

@onny
Copy link

onny commented Oct 2, 2022

I don't use payments too and would be happy to use InvoicePlane with PHP8. I'm trying to package this pull request on NixOS for easier testing in maybe upgrading to this unstable release to avoid dropping it due to missing PHP8 support: NixOS/nixpkgs#194059

I build it from source with

composer install --ignore-platform-req=ext-bcmath --ignore-platform-req=ext-gd
yarn build
yarn install

When opening Invoiceplane in the browser I get

Fatal error: Uncaught TypeError: Dotenv\Dotenv::__construct(): Argument #1 ($store) must be of type Dotenv\Store\StoreInterface, string given, called in /nix/store/fvcmmirjs4434624jbr0rlmla266q22q-invoiceplane-localhost-unstable-2022-08-08/index.php on line 18 and defined in /nix/store/fvcmmirjs4434624jbr0rlmla266q22q-invoiceplane-localhost-unstable-2022-08-08/vendor/vlucas/phpdotenv/src/Dotenv.php:60 Stack trace: #0 /nix/store/fvcmmirjs4434624jbr0rlmla266q22q-invoiceplane-localhost-unstable-2022-08-08/index.php(18): Dotenv\Dotenv->__construct() #1 {main} thrown in /nix/store/fvcmmirjs4434624jbr0rlmla266q22q-invoiceplane-localhost-unstable-2022-08-08/vendor/vlucas/phpdotenv/src/Dotenv.php on line 60

@nielsdrost7
Copy link
Contributor

nielsdrost7 commented Oct 2, 2022

@onny did you make a copy of the ipconfig.php.example file to ipconfig.php?
It's thr first thing I'm thinking of when I see these types of errors

@onny
Copy link

onny commented Oct 2, 2022

Thank you for the fast feedback. Should be present. It is the kind of config I used in Invoiceplane 1.5.11. Not sure if something changed in the meantime

$ curl http://localhost/ipconfig.php
IP_URL=http://localhost
ENABLE_DEBUG=false
DISABLE_SETUP=false
REMOVE_INDEXPHP=false
DB_HOSTNAME=localhost
DB_USERNAME=invoiceplane
# NOTE: file_get_contents adds newline at the end of returned string
DB_PASSWORD=
DB_DATABASE=invoiceplane
DB_PORT=3306
SESS_EXPIRATION=864000
ENABLE_INVOICE_DELETION=false
DISABLE_READ_ONLY=false
ENCRYPTION_KEY=
ENCRYPTION_CIPHER=AES-256
SETUP_COMPLETED=false

@nielsdrost7
Copy link
Contributor

nielsdrost7 commented Oct 2, 2022

Config looks good.
It's something else and it needs some debugging.

phpdotenv has changed (quick Google search)

@nielsdrost7
Copy link
Contributor

@onny can you move phpdotenv back to an older version?

"vlucas/phpdotenv": "^3.4.0"

@WalleBE
Copy link

WalleBE commented Oct 3, 2022

Hi, I cannot find the vendor-folder in the repository. Is it safe to use the folder from V 1.6.11?
If I do, I got this fault: Fatal error: Uncaught Error: Call to undefined method Dotenv\Dotenv::createImmutable() in /data/sites/web/www/ip_8/index.php:19 Stack trace: #0 {main} thrown in /data/sites/web/www/ip_8/index.php on line 19

@nielsdrost7
Copy link
Contributor

nielsdrost7 commented Oct 4, 2022

@WalleBE usually these types of questions go on the forums or in the slack channels, but I'll let it slide for this time. I've created a github issue #857 for you, so you can receive your answer.

Right now, here, we comment on the Pull-request, that gets us to PHP8 compatibility. Let's keep it that way

@onny
Copy link

onny commented Oct 4, 2022

@onny can you move phpdotenv back to an older version?

"vlucas/phpdotenv": "^3.4.0"

Oh sorry it seems it was my mistake. I patched index.php file in my NixOS module to override custom options/settings https://github.com/NixOS/nixpkgs/blob/fd54651f5ffb4a36e8463e0c327a78442b26cbe7/nixos/modules/services/web-apps/invoiceplane.nix#L42

There I used the dotenv function which doesn't seem to be compatible with the latest version of it. I need to fix this myself. On the other side Invoiceplane seems to work with PHP8.1 using this branch. Hope the development gets merged into master soon so we can start testing and fixing bugs :)

@nielsdrost7
Copy link
Contributor

Hope the development gets merged into master soon so we can start testing and fixing bugs :)

I'll merge into development soon.
I would love to keep the master version for when we make a release, which would also be very soon.

The plan is to put phpdotenv back to 3.4 and then merge this PHP 8.1 branch. Soon, soon.

I patched index.php file in my NixOS module to override custom options/settings
I'm interested in those customizations. Tell me on slack if you like

@onny
Copy link

onny commented Oct 4, 2022

For me it works with phpdotenv at the latest version. Version 3.4 won't probably work because it doesn't support PHP8

@nielsdrost7
Copy link
Contributor

@vtq221 @onny could you guys please contact me on our slack channels this weekend? I would love to go over some things with you
https://join.slack.com/t/invoiceplane/shared_invite/zt-sjirc9h2-952baR9rn4r8LyzRK9MveA

@naui95 naui95 linked an issue Oct 15, 2022 that may be closed by this pull request
@naui95 naui95 changed the base branch from development to feature/issue-798 October 15, 2022 11:33
@naui95 naui95 mentioned this pull request Oct 16, 2022
7 tasks
@nielsdrost7 nielsdrost7 merged commit 68ba3ee into InvoicePlane:feature/issue-798 Oct 16, 2022
@onny
Copy link

onny commented Oct 16, 2022

Thank you for merging :) Is this already in master or develop branch?

@nielsdrost7
Copy link
Contributor

nielsdrost7 commented Oct 16, 2022

@onny it's in the branch https://github.com/InvoicePlane/InvoicePlane/tree/feature/issue-798 for now.
This branch will help us to add more things, to prepare for the new release (npm packages update, readme, you know, the works)

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

Successfully merging this pull request may close these issues.

php 7.4 EoL in 9 months. php 8.1 required
6 participants