Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Fix compatibility with PHP 8 #270

Merged
merged 42 commits into from
May 31, 2021

Conversation

MrMage
Copy link
Contributor

@MrMage MrMage commented Apr 26, 2021

Fixes #267.

This PR includes the following changes:

  • Remove obsolete locking macros (https://www.seidengroup.com/2020/12/07/porting-extensions-to-php-8/, hat tip to @frost-byte)
  • Update some calls that now take a zend_object * instead of a zval *
  • Add now-required arginfo for a lot of methods that do not take any arguments
  • Remove an obsolete reference to PHP versions earlier than 7.0
  • Add CI for PHP 8.0
  • Remove CI for older versions of PHP, as the extensions contains backward-incompatible changes
  • Update all tests for compatibility with PHPUnit 9
  • Update composer.json for compatibility with PHP 8 and some newer package versions
  • Skip two failing integration tests

Once this is merged, I recommend tagging a 0.7.0 release. Note that that release will no longer be compatible with PHP 7, as PHP 8 introduced a bunch of backwards-incompatible changes to interfaces used by this extension.

Merging this PR will resolve a bunch of issues in this repo (formatted so that GitHub can parse them):

@MrMage
Copy link
Contributor Author

MrMage commented Apr 26, 2021

Note that compiling the extension unit tests passes; the build failure seems due to unrelated code coverage issues with PHPUnit.

@MrMage MrMage marked this pull request as draft April 26, 2021 07:44
@MrMage MrMage requested review from bshaffer and chingor13 May 5, 2021 09:00
@MrMage
Copy link
Contributor Author

MrMage commented May 6, 2021

@bshaffer could you please take a look?

@MrMage
Copy link
Contributor Author

MrMage commented May 12, 2021

A review from @bshaffer or @chingor13 would be greatly appreciated :-)

@CoolGoose
Copy link

For what it's worth, this patch does compile nicely on 8.0.3 👍 (working on other non related php8 compat until i can test this properly)

Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

I found some small nits but for the most part this looks good. Would love to get a C-review from @chingor13 !

.circleci/config.yml Show resolved Hide resolved
{
parent::setUp();
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be nesssary, nothing happens in setUp of the parent test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's good practice. Avoids nasty surprises if stuff later does get added to the parent implementation of setUp.

Copy link
Contributor

@bshaffer bshaffer May 25, 2021

Choose a reason for hiding this comment

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

I disagree with this strongly, it's confusing because it implies that something's being called in the setUp method. If ever this class gets extended (which is highly unlikely), it's very obvious to the person making the change that such logic would need to be added here (if the extended class contained the same methods). That's basic programming IMHO and does not need an attempt at future-proofing.

Also, this is a test class, so the risk is very small.

{
parent::setUp();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here... no reason to call parent::setUp

{
parent::setUp();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here... no reason to call parent::setUp

{
parent::setUpBeforeClass();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here... no reason to call parent::setUpBeforeClass

{
parent::setUp();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here... no reason to call parent::setUp

@MrMage
Copy link
Contributor Author

MrMage commented May 18, 2021

@bshaffer PTAL. I have added integration tests for PHP 7.4 now (including WordPress), but I'd like to keep the parent::setUp calls to avoid nasty surprises if stuff later does get added to the parent implementation of setUp.

@MrMage MrMage requested a review from bshaffer May 25, 2021 14:49
@MrMage
Copy link
Contributor Author

MrMage commented May 25, 2021

Friendly ping @bshaffer @chingor13.

Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

Once the unnecessary parent calls are removed, this is LGTM from the PHP-side for me. We will still need @chingor13 to sign off on the C-side

@MrMage
Copy link
Contributor Author

MrMage commented May 25, 2021 via email

@MrMage
Copy link
Contributor Author

MrMage commented May 25, 2021 via email

@bshaffer
Copy link
Contributor

Never mind, only saw your comments on that now. Will remove those tomorrow.

I know it's a nit, so thank you!

@MrMage MrMage requested a review from bshaffer May 26, 2021 07:47
@MrMage
Copy link
Contributor Author

MrMage commented May 26, 2021

@bshaffer removed the parent calls now, PTAL :-)

Would you mind pinging chingor13 to have a look at the C part? I'd like to get this merged soon, if possible.

@MrMage MrMage mentioned this pull request May 26, 2021
@MrMage
Copy link
Contributor Author

MrMage commented May 28, 2021

Thanks for the reviews! @bshaffer, would you please merge this?

@bshaffer bshaffer merged commit 0cfda50 into census-instrumentation:master May 31, 2021
@bshaffer
Copy link
Contributor

bshaffer commented May 31, 2021

@MrMage mergred and released v0.7.0!

thanks for your hard work on this!!

@MrMage
Copy link
Contributor Author

MrMage commented Jun 4, 2021

Thanks @bshaffer! It would be great if someone with the appropriate permissions (probably @chingor13) could also update the package on PECL; it hasn't been updated in a while (also see #243 and #252).

@chingor13
Copy link
Member

0.3.0 should be available on PECL

@lepiaf lepiaf mentioned this pull request Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants