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

Fix - Fatal error when facebook_config option is empty. #2517

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

rawdreeg
Copy link
Contributor

Changes proposed in this Pull Request:

We received a report of a fatal error in the Pixel Event class. After investigation, I noticed that if the facebook_config option is an empty string, the value returned by get_options would be an empty string, causing the exception: error message: Uncaught TypeError: Cannot access offset of type string on string.

This assumes that facebook_config will always contain a serialized object, and the error is, in fact, caused by the facebook_config option being empty.

Closes #2516.

  • Do the changed files pass phpcs checks? Please remove phpcs:ignore comments in changed files and fix any issues, or delete if not practical.

Detailed test instructions:

  1. log in as an admin, and navigate to wp-admin/options.php then delete the content of facebook_config.
  2. navigate to any admin page, and you should receive the fatal error.
  3. Switch to this branch, and the fatal should be gone.

Changelog entry

Fix - Fatal error when facebook_config option is empty.

@rawdreeg rawdreeg requested a review from a team April 11, 2023 09:45
@rawdreeg rawdreeg self-assigned this Apr 11, 2023
@github-actions github-actions bot added changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug. labels Apr 11, 2023
Copy link
Contributor

@budzanowski budzanowski left a comment

Choose a reason for hiding this comment

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

Nice! :shipit:

@rawdreeg rawdreeg merged commit 5aa0bfe into develop Apr 11, 2023
@rawdreeg rawdreeg deleted the fix/2516-pixel_event_fatal branch April 11, 2023 10:56
@ecgan
Copy link
Contributor

ecgan commented Apr 11, 2023

@rawdreeg , in the issue #2516, the users mentioned the issue only happens when they upgraded to use PHP 8.1, it did not happen when they were using PHP 7.4. Do you know why? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP 8.1 fatal error with Facebook Pixel Event
3 participants