backdrop-ops / backdropcms.org

Issue tracker for the BackdropCMS.org website
https://backdropcms.org
25 stars 21 forks source link

PHP 8 Hosting Upgrades #940

Open larsdesigns opened 2 years ago

larsdesigns commented 2 years ago

The end of life for php 7 security support is November 28th 2022: https://www.php.net/supported-versions.php

I will be upgrade the servers to php 8.1. in the next few days. I will begin by upgrading the beta.backdropcms.org server first. After testing is successful, I will proceed with upgrading production. The beta.backdropcms.org VM is a clone of production and should be a great testing environment.

A list of sites from nginx configuration:

larsdesigns commented 2 years ago

@jenlampton, Are there any known PHP issues that you know of? I was unable to find any in backdrop-ops but I have not checked CiviCRM.

jenlampton commented 2 years ago

It would surprise me if there weren't any, but I can't remember anything off hand.

larsdesigns commented 2 years ago

I have replaced php 7.4 and php 7.2 with php 8.0 and tested the sites using an /etc/hosts entry on my workstation for the configuration domains.

@stpaultim, Would you be some kind as to help with testing?

larsdesigns commented 2 years ago

Everything seems okay except that drush is giving an error.

Drush is at version 8 and the error is:

PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /home/backdrop/.composer/vendor/drush/drush/includes/command.inc on line 860

I installed drush 11 using composer but it will not run either. It is turning in to a late one so I will pick it up later today.

I restored the original drush files in the /home/backdrop directory for now.

Just a reminder that only the beta server is being worked on.

larsdesigns commented 2 years ago

I was able to get drush installed and running on php8.0.

jenlampton commented 2 years ago

@larsdesigns backdrop support for Drush only works for Drush 8 (so, no need to update to Drush 11, 10, or even 9). If we do ever run into issues with Drush 8, that would be a good time to switch to bee :)

larsdesigns commented 2 years ago

It was decided today during the core developer meeting that I would proceed with replacing drush 8 with Backdrop CMS Bee: https://backdropcms.org/project/bee.

I will scan the other sites with the phpcs php 8 checker but I could probably use some help with testing those.

So far there have been no problems reported from Civi. I am getting close to coming to point where I can promote the PHP 8 updates to production.

larsdesigns commented 2 years ago

Completed the following:

  1. Installed bee on the beta server and made it executable.
  2. Tested it by running a few commands and it seems to be working great. Screen Shot 2022-10-26 at 4 28 04 AM
  3. I will finish the phpcs scan of the other sites and if the results are okay, I will proceed with updating production this weekend.
larsdesigns commented 2 years ago

I will be moving forward with the upgrade on production in a couple hours.

larsdesigns commented 2 years ago

Completed the following tasks:

  1. Installed and configured PHP 8.0 using available Debian packages available via Aptitude.
  2. Updated the Nginx configuration to use PHP 8.0 FPM for each site and carefully migrated php.ini values from the php 7.4 configuration.
  3. I have temporarily left php 7.4-fpm running along side php 8.0-fpm just in case we run into a critical bug and need to revert quickly.
  4. Installed and configured the bee cli utility to be available for all users to execute. In installed bee in /home/backdrop/.bee and is sym linked to /usr/local/bin/bee as recommended in the installation instructions.
  5. Updated the OS packages and restarted the server.
  6. Checked the forum, events and backdropcms.org sites to make sure they are running, able to check for module updates and are using the intended php 8.0 configuration.

I will leave this ticket open for a little while and close it when I uninstall and clean off php 7.4 from the server.

Please report back any errors that are discovered and could potentially related to the upgrade.

stpaultim commented 2 years ago

@larsdesigns - The forum is not working, in that I am unable to comment on or post new topics in the forum. I assume this is related to the PHP upgrade.

We are getting the following errors:

Call to undefined function each()

This indicates to me that we might have an error in our code for the Forum that isn't PHP 8 compatible? I think we have some custom code there.

klonos commented 2 years ago

FTR: the problem is with the SMTP contrib module, and it is fixed by the PR here: https://github.com/backdrop-contrib/smtp/issues/16

larsdesigns commented 2 years ago

I have rolled back to 7.4 for all of the sites. Let's give it another go after smtp module is fixed.

Also, I found some changes that need to be made in the theme.

I found two calls to `each()` in template.php in the borg theme on lines 394 and and 414.
larsdesigns commented 2 years ago

It looks like the recent release of the backdrop.org has been fixed and is compatible with PHP 8. I am going to update that site to PHP 8.1.

larsdesigns commented 2 years ago

I have implemented php 8.1 for backdropcms.org and tested the smtp module by sending myself a password reset e-mail. It seems to be running okay.

I will work on evaluating the other sites for upgrade.

larsdesigns commented 2 years ago

I have updated sanitize.backdropcms.org to use PHP 8.1 and checked the site. The sanitize script has been using 8.1 since last October.

bugfolder commented 2 years ago

I just updated a module (ip) on b.org (which is on version 1.23.0) that required a db/config update, and running update.php issued a bunch of identical warnings:

Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in system_requirements() (line 472 of /home/backdrop/repo/www/core/modules/system/system.install).

larsdesigns commented 1 year ago

I checked for the each() function in all of the sites and found the following usages:

╰─ grep -rni " each(" .
./docs/backdrop-code-to-index/core/misc/states.js:392:        // Break the each() loop if this is checked.
./docs/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./docs/repo/www/modules/contrib/diff/DiffEngine.php:315:        while (list ($junk, $y) = each($matches)) {
./docs/repo/www/modules/contrib/diff/DiffEngine.php:323:        while (list ($junk, $y) = each($matches)) {
./localize/repo/www/sites/all/modules/contrib/l10n_server/l10n_community/welcome.inc:174:    list($language_code, $language_name) = each($language_list);
./localize/repo/www/sites/all/modules/contrib/smtp/smtp.phpmailer.inc:1637:    while ( list(, $line) = each($lines) ) {
./forum/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./forum/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614:    while ( list(, $line) = each($lines) ) {
./forum/repo/www/themes/borg/template.php:515:  // Assigning the array to $flat resets the array pointer for use with each().
./forum/repo/www/themes/borg/template.php:519:    list($key, $curr) = each($flat);
./forum/repo/www/themes/borg/template.php:537:  // Assigning the array to $flat resets the array pointer for use with each().
./forum/repo/www/themes/borg/template.php:539:    list($key, $curr) = each($flat);
./dcu/repo/www/includes/bootstrap.inc:3788:    while (list($key, $callback) = each($callbacks)) {
./dcu/repo/www/includes/install.inc:782:    while (list($module) = each($module_list)) {
./dcu/repo/www/includes/menu.inc:579:          list($function, $args) = each($function);
./dcu/repo/www/includes/menu.inc:2405:      list($key, $curr) = each($tree);
./dcu/repo/www/includes/menu.inc:2435:      list($key, $curr) = each($tree);
./dcu/repo/www/includes/module.inc:407:    while (list($module) = each($module_list)) {
./dcu/repo/www/includes/module.inc:543:    while (list($module) = each($module_list)) {
./dcu/repo/www/modules/locale/locale.test:3192:        while ($equal && list($id) = each($negotiation)) {
./dcu/repo/www/modules/locale/locale.test:3193:          list(, $info_id) = each($info['fixed']);
./dcu/repo/www/modules/book/book.module:771:  // Assigning the array to $flat resets the array pointer for use with each).
./dcu/repo/www/modules/book/book.module:775:    list($key, $curr) = each($flat);
./dcu/repo/www/modules/book/book.module:809:  // Assigning the array to $flat resets the array pointer for use with each).
./dcu/repo/www/modules/book/book.module:811:    list($key, $curr) = each($flat);
./api/backdrop-code-to-index/core/misc/states.js:392:        // Break the each() loop if this is checked.
./api/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./api/repo/www/modules/contrib/diff/DiffEngine.php:315:        while (list ($junk, $y) = each($matches)) {
./api/repo/www/modules/contrib/diff/DiffEngine.php:323:        while (list ($junk, $y) = each($matches)) {
./api/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614:    while ( list(, $line) = each($lines) ) {
./api/repo/www/themes/borg/template.php:515:  // Assigning the array to $flat resets the array pointer for use with each).
./api/repo/www/themes/borg/template.php:519:    list($key, $curr) = each($flat);
./api/repo/www/themes/borg/template.php:537:  // Assigning the array to $flat resets the array pointer for use with each).
./api/repo/www/themes/borg/template.php:539:    list($key, $curr) = each($flat);
./events/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./events/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614:    while ( list(, $line) = each($lines) ) {

It looks like we need to make small changes to the borg theme or update it and update the smtp module.

jenlampton commented 1 year ago

We don't use the dcu site so those can be ignored, as can the JavaScript. It looks close!

On Thu, Dec 1, 2022, 1:53 PM Justin Christoffersen @.***> wrote:

I checked for the each() function in all of the sites and found the following usages:

╰─ grep -rni " each(" .

./docs/backdrop-code-to-index/core/misc/states.js:392: // Break the each() loop if this is checked.

./docs/repo/www/core/misc/states.js:392: // Break the each() loop if this is checked.

./docs/repo/www/modules/contrib/diff/DiffEngine.php:315: while (list ($junk, $y) = each($matches)) {

./docs/repo/www/modules/contrib/diff/DiffEngine.php:323: while (list ($junk, $y) = each($matches)) {

./localize/repo/www/sites/all/modules/contrib/l10n_server/l10n_community/welcome.inc:174: list($language_code, $language_name) = each($language_list);

./localize/repo/www/sites/all/modules/contrib/smtp/smtp.phpmailer.inc:1637: while ( list(, $line) = each($lines) ) {

./forum/repo/www/core/misc/states.js:392: // Break the each() loop if this is checked.

./forum/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614: while ( list(, $line) = each($lines) ) {

./forum/repo/www/themes/borg/template.php:515: // Assigning the array to $flat resets the array pointer for use with each().

./forum/repo/www/themes/borg/template.php:519: list($key, $curr) = each($flat);

./forum/repo/www/themes/borg/template.php:537: // Assigning the array to $flat resets the array pointer for use with each().

./forum/repo/www/themes/borg/template.php:539: list($key, $curr) = each($flat);

./dcu/repo/www/includes/bootstrap.inc:3788: while (list($key, $callback) = each($callbacks)) {

./dcu/repo/www/includes/install.inc:782: while (list($module) = each($module_list)) {

./dcu/repo/www/includes/menu.inc:579: list($function, $args) = each($function);

./dcu/repo/www/includes/menu.inc:2405: list($key, $curr) = each($tree);

./dcu/repo/www/includes/menu.inc:2435: list($key, $curr) = each($tree);

./dcu/repo/www/includes/module.inc:407: while (list($module) = each($module_list)) {

./dcu/repo/www/includes/module.inc:543: while (list($module) = each($module_list)) {

./dcu/repo/www/modules/locale/locale.test:3192: while ($equal && list($id) = each($negotiation)) {

./dcu/repo/www/modules/locale/locale.test:3193: list(, $info_id) = each($info['fixed']);

./dcu/repo/www/modules/book/book.module:771: // Assigning the array to $flat resets the array pointer for use with each).

./dcu/repo/www/modules/book/book.module:775: list($key, $curr) = each($flat);

./dcu/repo/www/modules/book/book.module:809: // Assigning the array to $flat resets the array pointer for use with each).

./dcu/repo/www/modules/book/book.module:811: list($key, $curr) = each($flat);

./api/backdrop-code-to-index/core/misc/states.js:392: // Break the each() loop if this is checked.

./api/repo/www/core/misc/states.js:392: // Break the each() loop if this is checked.

./api/repo/www/modules/contrib/diff/DiffEngine.php:315: while (list ($junk, $y) = each($matches)) {

./api/repo/www/modules/contrib/diff/DiffEngine.php:323: while (list ($junk, $y) = each($matches)) {

./api/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614: while ( list(, $line) = each($lines) ) {

./api/repo/www/themes/borg/template.php:515: // Assigning the array to $flat resets the array pointer for use with each).

./api/repo/www/themes/borg/template.php:519: list($key, $curr) = each($flat);

./api/repo/www/themes/borg/template.php:537: // Assigning the array to $flat resets the array pointer for use with each).

./api/repo/www/themes/borg/template.php:539: list($key, $curr) = each($flat);

./events/repo/www/core/misc/states.js:392: // Break the each() loop if this is checked.

./events/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614: while ( list(, $line) = each($lines) ) {

It looks like we need to make small changes to the borg theme or update it and update the smtp module.

— Reply to this email directly, view it on GitHub https://github.com/backdrop-ops/backdropcms.org/issues/940#issuecomment-1334493163, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADBERYRMFBMGZ27XMAIUITWLEM4DANCNFSM6AAAAAAQYDXBDM . You are receiving this because you were mentioned.Message ID: @.***>

larsdesigns commented 1 year ago

@jenlampton, I enabled php 8.1 for a few more projects and updated the check list.