Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Warning: Undefined array key when rollback any theme #5762

Closed
4 tasks
Mai-Saad opened this issue Feb 15, 2023 · 1 comment · Fixed by #5768
Closed
4 tasks

PHP Warning: Undefined array key when rollback any theme #5762

Mai-Saad opened this issue Feb 15, 2023 · 1 comment · Fixed by #5768
Assignees
Labels
effort: [XS] < 1 day of estimated development time module: cache priority: low Issues that can wait severity: minor Defect that does not affect functionality type: bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@Mai-Saad
Copy link

Before submitting an issue please check that you’ve completed the following steps:

  • Made sure you’re on the latest version => 3.12.5.3
  • Used the search feature to ensure that the bug hasn’t been reported before

Describe the bug
When rollback any theme while WPR is enabled, we will get the following warning
[15-Feb-2023 09:08:58 UTC] PHP Warning: Undefined array key "themes" in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/inc/common/purge.php on line 563

To Reproduce
Steps to reproduce the behavior:
1. Rollback plugin is enabled
2. WPR is enabled
3. Try to rollback any theme
4. Check debug.log

Expected behavior
No warning when rollback

Additional context
Add any other context about the problem here.

  • tested on Nginx/Apache
  • same warning exists with 3.11.5

Backlog Grooming (for WP Media dev team use only)

  • Reproduce the problem
  • Identify the root cause
  • Scope a solution
  • Estimate the effort
@Mai-Saad Mai-Saad added type: bug Indicates an unexpected problem or unintended behavior module: cache priority: low Issues that can wait severity: minor Defect that does not affect functionality labels Feb 15, 2023
@mostafa-hisham mostafa-hisham added the GROOMING IN PROGRESS Use this label when the issue is currently being groomed. label Feb 17, 2023
@mostafa-hisham
Copy link
Contributor

Reproduce the problem ✔️

Identify the root cause

$hook_extra array can not hold a theme key

Scope a solution

We need to check if the hook array contains 'theme' key

	if ( ! isset ($hook_extra['themes']) || ! is_array( $hook_extra['themes'] ) ) {
		return;
	}

Estimate the effort

Effort XS

@mostafa-hisham mostafa-hisham added effort: [XS] < 1 day of estimated development time and removed GROOMING IN PROGRESS Use this label when the issue is currently being groomed. labels Feb 17, 2023
@mostafa-hisham mostafa-hisham self-assigned this Feb 17, 2023
@piotrbak piotrbak added this to the 3.13.1 milestone Mar 1, 2023
@piotrbak piotrbak modified the milestones: 3.13.1, 3.13 Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: [XS] < 1 day of estimated development time module: cache priority: low Issues that can wait severity: minor Defect that does not affect functionality type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants