Fix fatal error on PHP 7.2 with subclasses not implementing same parent signature.

Declaration of Drupal\purge\Plugin\Purge\Invalidation\WildcardPathInvalidation::validateExpression() must be compatible with Drupal\purge\Plugin\Purge\Invalidation\PathInvalidation::validateExpression($wildcard_check = true)

Comments

dpi created an issue. See original summary.

dpi’s picture

Assigned: dpi » Unassigned
Status: Active » Needs review
StatusFileSize
new3.85 KB

Patch converts param to property with default value. Doesnt seem to be called with different args outside of class.

dpi’s picture

StatusFileSize
new4.05 KB
guschilds’s picture

Status: Needs review » Reviewed & tested by the community

We started getting the same error after upgrading from PHP 7.1 to 7.2, while adding a wildcardurl to the queue. This patch resolved the issue for us. Going to mark this as RTBC, though admittedly, I'm not familiar enough with the codebase to know if it truly is the best fix. Thanks!

EDIT: I should probably also mention that we also have https://www.drupal.org/files/issues/2921309-17-port-purge-drush-9.patch applied and are running the p:queue:add command with a wildcardurl.

nielsvm’s picture

Status: Reviewed & tested by the community » Needs work

This error looks familiar and I remember I've fixed it earlier, also, my development environment runs on PHP 7.3.9.

Can we confirm that this error no longer happens and that this can be closed?

recrit’s picture

This is still needed. The module should adhere to its own interface defined in Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface which does not have any arguments:

public function validateExpression();
recrit’s picture

Status: Needs work » Needs review
StatusFileSize
new4.21 KB

Re-rolled the patch against the latest 8.x-3.x.

marcingy’s picture

Title: Fix PHP7.1 subclass signature error » Fix PHP7.2 subclass signature error
acbramley’s picture

The failures in #7 are also failing on HEAD so are unrelated to this issue.

acbramley’s picture

Status: Needs review » Reviewed & tested by the community
aspilicious’s picture

Can someone verify the test fix patch? #3138392: Fix tests

dpi’s picture

StatusFileSize
new4.13 KB

Rerolled after "drupal9-kernel-tests" branch merge.

Diff based off b49bced

kim.pepper’s picture

Issue tags: +#pnx-sprint
japerry’s picture

Issue tags: +purge-3.1

Committed to the 3.1 branch, looks good to me.

  • nielsvm committed d87042a on 8.x-3.x authored by dpi
    Issue #3006680 by dpi: Fix PHP7.2 subclass signature error
    
nielsvm’s picture

Status: Reviewed & tested by the community » Fixed

Merged, thank you for this uncatched fix!

https://www.drupal.org/project/purge/issues/3236847

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.