Skip to content

Fixes that allow PHP 5.2-fpm to run and test WordPress#46

Closed
desrosj wants to merge 52 commits intotrunkfrom
desrosj/cli-support-old-php
Closed

Fixes that allow PHP 5.2-fpm to run and test WordPress#46
desrosj wants to merge 52 commits intotrunkfrom
desrosj/cli-support-old-php

Conversation

@desrosj
Copy link
Member

@desrosj desrosj commented Oct 19, 2020

The WP-CLI did not support PHP 5.2. However, in order to better automate testing, PHP 5.4 is now being used as the base for the 5.2 CLI image. This may result in some strange behavior, but a warning has been added for when the Docker container is started.

The WP-CLI did not support PHP 5.2. However, in order to better automate testing, PHP 5.4 is now being used as the base for the 5.2 CLI image. This may result in some strange behavior, but a warning has been added for when the Docker container is started.
@desrosj desrosj self-assigned this Oct 19, 2020
@desrosj desrosj requested a review from pento October 19, 2020 20:25
@desrosj
Copy link
Member Author

desrosj commented Oct 19, 2020

Hmm, looks like we won't be able to use https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar (it's a bit too modern using __DIR__). If this is on the right track though, I can find the best CLI version to use.

Copy link
Member

@pento pento left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's along the lines of what I was thinking, yes. I've added some comments on cleaning up some of the now redundant bits.

update.php Outdated

$dockerfile = str_replace( '%%MYSQL_CLIENT%%', $config['mysql_client'], $dockerfile );
$dockerfile = str_replace( '%%DOWNLOAD_URL%%', $config['download_url'], $dockerfile );
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with removing NEW_PHP from the Dockerfile template, this entire else block can go.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left this for now in case we need to add 5.2 specific logic.

@desrosj desrosj changed the title Use PHP 5.4-fpm as the base image for the cli:5.2-fpm image. Fixes that allow PHP 5.2-fpm to run and test WordPress Oct 26, 2020
@desrosj
Copy link
Member Author

desrosj commented Oct 26, 2020

I'm a bit stuck here, and not sure there is a good way forward. Here are some findings I have and where I'm at:

I've been able to successfully run the PHP 5.2 WP-CLI image and installation scripts with PHP 5.3 installed with one modification to the wordpress-develop tools/local-env/scripts/install.js file. The config set commands need to have --type-constant added, which ensures the constant is added when not present (the wp-config.php template previously did not include the constants with default values).

There's a different roadblock when running PHPUnit on PHP 5.2. The Docker files install PHPUnit using the PHAR files distributed officially by PHPUnit. https://phar.phpunit.de/phpunit-3.phar resolves to the most recent 3.x version, which is 3.7.38. PHPUnit 3.7 raises the minimum PHP requirement to 5.3.3, so PHPUnit 3.6 is required. There are also no PHPUnit < 3.7 PHARs available.

In 2014, PHPUnit switched from distributing with PEAR to using PHARs, and removed the PEAR packages at the end of the year. It seems that with the passing of time, there is now no way to download and install PHPUnit 3.6.

I tried running PHPUnit with PHP 5.3/PHPUnit 3.7.38. This did not work due to fatal errors (probably from changes in PHPUnit from 3.6 -> 3.7. I can't even find documentation for, and upgrading old branches to run on 3.7.38 is 100% something I'd like to avoid.

The devilbox image that is currently being used to build PHP 5.2 documents that PHPUnit is available within all containers. I was unable to confirm it is installed within the 5.2 one, though.

I was able to do some archaeology on the PHPUnit GitHub repo, and found the commit that released PHPUnit 3.6. One option is to check this repo/SHA out directly and use the Git Checkout instructions. It will require some more digging in the dependency repositories for specific SHAs that need to be used, but unless I am missing something this may be the only option to get PHPUnit 3.6 running in the container.

@desrosj
Copy link
Member Author

desrosj commented Oct 26, 2020

The last thing I forgot to mention is the current testing setup on Travis is working because the 5.2 image being used has PHPUnit 3.6 installed, so it just works within that environment.

@desrosj
Copy link
Member Author

desrosj commented Oct 26, 2020

@desrosj desrosj changed the base branch from master to php-8-latest January 27, 2021 14:27
@desrosj desrosj changed the base branch from php-8-latest to master January 27, 2021 14:27
@johnbillion
Copy link
Member

I think this can be closed

@desrosj desrosj closed this Jul 26, 2024
@desrosj desrosj deleted the desrosj/cli-support-old-php branch July 26, 2024 16:40
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.

3 participants