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 PHP Error when Term Taxonomy points to non-existing term_id #560

Open
wants to merge 3 commits into
base: 4.0
Choose a base branch
from

Conversation

kasus
Copy link

@kasus kasus commented May 12, 2021

  • Corcel Version: 4.0.1
  • Framework Name & Version: Laravel 7
  • PHP Version: 7.4
  • Database Driver & Version: MySQL

Description:

If term has been deleted from terms table but reference to it left in term_taxonomy table, it throws a PHP error when trying to reach $post->terms attribute.
Since there are no foreign keys in WP tables, additional checking in code is needed.

Steps To Reproduce:

PHPUnit test is included in commit.
Create a Taxonomy with term_id = 0 and attach to the Post, try to get $post->terms attribute.

@kasus kasus force-pushed the handle_corrupted_terms branch 2 times, most recently from a1663c7 to 674bf6e Compare May 12, 2021 12:34
@jgrossi
Copy link
Member

jgrossi commented Sep 30, 2021

hey @kasus all good to me. can you just fix this conflict with the composer.lock file please? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants