Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

PHP 7.4 Compatibility #20

Merged
merged 1 commit into from
Mar 12, 2020
Merged

PHP 7.4 Compatibility #20

merged 1 commit into from
Mar 12, 2020

Conversation

felipeelia
Copy link
Member

Description of the Change

As described in #19, after updating to PHP 7.4, the Trying to access array offset on value of type null error is triggered. It seems to be related to this backward incompatible change.

This PR changes the tearDown() method of the TestCase class, checking if the $last_modifying_query attribute is not empty before using it as an array.

Additionally, it also changes the Database class:

  • Pointing to the right Log class
  • Updating the getLastModifyingQuery() return doc

Alternate Designs

N/A.

Benefits

PHP 7.4 Compatibility.

Possible Drawbacks

As far as I can see, none.

Verification Process

Just a couple of manual verifications using an already setup project.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Fix #19

Changelog Entry

Fixed PHP 7.4 Compatibility

- TestCase: Check if `$this->last_modifying_query` is not empty
- Database:
-- Point to the right Log class
-- Update the `getLastModifyingQuery()` return doc
@johnwatkins0
Copy link
Member

I can confirm this works. I encountered the issue in both PHP 7.2 and 7.3 (running in a GitHub action). After switching the dependency to @felipeelia 's fork/branch, the issue was resolved. I suggest we merge this.

@jeffpaul
Copy link
Member

Confirmed with @tlovett1 that we're good to merge this in; I'll work to tag a release as well so we can plan and build off this with our other projects.

@jeffpaul jeffpaul merged commit 673a501 into 10up:master Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestCase::last_modifying_query can be empty during tearDown()
3 participants