ChurchCRM / CRM

ChurchCRM is an OpenSource Church CRM & Management Software.
https://ChurchCRM.io
MIT License
626 stars 444 forks source link

PHP 8 #6101

Closed pksteit closed 1 year ago

pksteit commented 1 year ago

I've got a WebSite on Aruba Hosting... and I need PHP 8... When we could use PHP 8 on Church CRM?

MrClever commented 1 year ago

There is no estimate on when ChurchCRM will be ready for PHP8 (unfortunately). We're a very small dev team and all of us have day jobs so it may be a while. If possible, use PHP7.4

mounte commented 1 year ago

It was a very long time since I last touched php. Not sure how well or how far "automated" tools would get but maybne worthwhile to structure upgrade using for instance https://github.com/rectorphp/rector Anyone with experience using rector?

dolibarr95 commented 1 year ago

Hi there Is there a roadmap, or todo list for php 8 so I can help ?

Regards

DawoudIO commented 1 year ago

@dolibarr95 I have started and created a branch for PHP 8 - https://github.com/ChurchCRM/CRM/pull/6133 I was doing some testing but It was not fully work, so I have a list of pages to test and fix.

If you can help with testing and fixing bugs it would be great.

dolibarr95 commented 1 year ago

Hello 🙂 @DawoudIO tks for this answer. Ok I will install it on a php8 very soon and try to help.

Tks for the great job !

brimarq commented 1 year ago

Any word on PHP 8 support? My host is beginning to charge extra for PHP extended support for 7.x versions, and I need to upgrade. I'd prefer to use v8.2 - will it work?

DawoudIO commented 1 year ago

here you go - https://github.com/ChurchCRM/CRM/releases/tag/5.0.0-beta1 give it a try and let me know if there is any issues.

brimarq commented 1 year ago

Hmm... looks like this line will reject any version of PHP 8.x?

In the 5.0.0-beta1 pre-release it's written as the following in index.php:

if (version_compare(phpversion(), "7.4.0", "<") || version_compare(phpversion(), "8.0.0", ">=")) { header("Location: php-error.html"); exit; }

Which sould seem to explain why I kept getting the php-error page using both PHP v8.1.x and v8.2.x. I'm not a PHP dev, but that code looks like it will reject PHP 7 versions less than v7.4.0 and any versions of PHP 8 and above by redirecting to the php-error.html page. Is that correct?

Ref: https://www.php.net/manual/en/function.version-compare.php

@DawoudIO

DawoudIO commented 1 year ago

Let me check tonight

DawoudIO commented 1 year ago

Yes that was fixed but not releases try going to /v2 vs /

brimarq commented 1 year ago

I found some other issues, too... I'll be posting them here shortly.

brimarq commented 1 year ago

Yes that was fixed but not releases try going to /v2 vs /

/v2 gives a 500 error.

brimarq commented 1 year ago

I set up a Docker test environment to run ChurchCRM v4.4.5 on localhost root directory using PHP v7.4.30 to closely match what I currently have running in production. That installed, successfully imported a database dump, and ran just fine as far as I can tell.

Next, I replaced the ChurchCRM v4.4.5 files with those from the v5.0.0-beta1 release, retaining the Include/Config.php file.

Still using PHP 7.4.30, browsing to the localhost root I got Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". I'm assuming that is due to this line in composer.json.

Ok, fine. I swapped out PHP v7.4.30 for v8.2.6. Browsing to localhost root with that setup serves the php-error.html page (this also happens with PHP v8.1.x). I'm sure this is due to the issue I mentioned previously.

I then browsed directly to /SystemDBUpdate.php and clicked the "Upgrade database" button. This apparently succeeded and redirected to /session/begin, where I was able to login successfully. There are some problems, which I will mention in a following post.

I will say here, though, that attempting a fresh install with the v5.0.0-beta1 release simply would not work at all for me. As I mentioned before, browsing to the churchcrm root simply serves the php-error.html page when using PHP v8.x. Going directly to /setup serves a "Slim Application Error".

DawoudIO commented 1 year ago

If you can share the docker file I can look into the errors

I'll release a 2nd beta tonight

brimarq commented 1 year ago

Aside from the problems I had with getting the 5.0.0-beta1 running, the most problematic issue I encountered is that the body contents of certain group/sunday school view pages simply will not load. On browsing to those, the pages lock up and the console shows a 500 internal server error. You can see examples of what I experienced using the live ChurchCRM demo after logging in:

Groups -> Unassigned -> Boys Scouts https://demo.churchcrm.io/master/GroupView.php?GroupID=7 Groups -> Unassigned -> Church Board https://demo.churchcrm.io/master/GroupView.php?GroupID=9 Groups -> Unassigned -> Clergy https://demo.churchcrm.io/master/GroupView.php?GroupID=11 Sunday School -> Classes -> Angels Class https://demo.churchcrm.io/master/sundayschool/SundaySchoolClassView.php?groupId=1 Sunday School -> Classes -> Class 1-3 https://demo.churchcrm.io/master/sundayschool/SundaySchoolClassView.php?groupId=2

DawoudIO commented 1 year ago

Perfect let me look at these before I make the next beta

Thanks for your help

brimarq commented 1 year ago

The other issue is mostly an aesthetic one, which you can see examples of in the demo here:

Deposit -> View All Deposits https://demo.churchcrm.io/master/FindDepositSlip.php Sunday School -> Dashboard https://demo.churchcrm.io/master/sundayschool/SundaySchoolDashboard.php

The most troublesome of the two is in the Deposit Listing page. There, in the Deposit ID column of the Deposits table, the blue .fa-square svg icons in the .fa-stack are too large, and they obscure the deposit ID numbers in each row. (FWIW, I also noticed this in the v4.5.4 release)

In the 5.0.0-beta1, the following CSS is set on the <i class="fa fa-square fa-stack-2x"> element within the fa-stack (which is not so in v4.4.5):

.svg-inline--fa.fa-stack-2x {
    height: 2em;
    width: 2.5em;
}

Looks like this is coming from fontawesome. Is this a similar issue? ChurchCRM v4.4.5 uses the same fa-stack icons, but doesn't have this problem.

I used a quick-and-dirty hack with inline styling to set height and width to 100% directly on the element here, like so: <i class="fa fa-square fa-stack-2x" style="height:100%;width:100%;">

This works to correct the svg icon size and allow the Deposit ID numbers to be seen again; but of course, it will cause the integrity check to fail if we do it on our end. And it would need to be applied in more than one place, which would fix the Sunday School Dashboard and a couple of other places I missed seeing.

brimarq commented 1 year ago

If you can share the docker file I can look into the errors

I'll release a 2nd beta tonight

Here's the test environment that I used: https://github.com/brimarq/docker-churchcrm-test-env

DawoudIO commented 1 year ago

here is beta2 fixing the version check, I'll keep testing with your docker and see if i can fix these 500 errors, thank you for helping me debug php8 and glad we did not release it 5.0.0 yet

brimarq commented 1 year ago

here is beta2 fixing the version check, I'll keep testing with your docker and see if i can fix these 500 errors, thank you for helping me debug php8 and glad we did not release it 5.0.0 yet

Tried the beta2 - php-error page issue is solved, but I still get a 500 (Internal Server Error) in the console with a "Slim Application Error" page at /setup upon trying to launch a fresh install using PHP 8.2 with my test env. Is there something missing in my test env? It worked fine to fresh install v4.4.5 with PHP 7.4, passing all of the application prerequisite tests. The PHP 8.2 config is setup the same except for the version... what is different now?

brimarq commented 1 year ago

here is beta2 fixing the version check, I'll keep testing with your docker and see if i can fix these 500 errors, thank you for helping me debug php8 and glad we did not release it 5.0.0 yet

Tried the beta2 - php-error page issue is solved, but I still get a 500 (Internal Server Error) in the console with a "Slim Application Error" page at /setup upon trying to launch a fresh install using PHP 8.2 with my test env. Is there something missing in my test env? It worked fine to fresh install v4.4.5 with PHP 7.4, passing all of the application prerequisite tests. The PHP 8.2 config is setup the same except for the version... what is different now?

Any progress @DawoudIO? I've got logs if you need them; but, I'm sure you can produce the same ones on your end with the test env.

DawoudIO commented 1 year ago

ya found a few issues with the sunday school pages, I'll try to get them fixed this weekend.

herrysim commented 1 year ago

Thank You @DawoudIO ..waiting for your release.

markginter31 commented 1 year ago

I'm seeing this when I try to setup beta 2: Slim Application Error

The application could not run because of the following error: Details Type: TypeError Message: key_exists(): Argument #2 ($array) must be of type array, null given File: /var/www/html/churchcrm/ChurchCRM/Authentication/AuthenticationManager.php Line: 23

brimarq commented 1 year ago

Any progress on this? Looks like the demo site is down.

DawoudIO commented 1 year ago

releasing 5.0.0 today