Skip to content

[5.x] fix save crash after deleting a Bard set containing a hidden field#15010

Closed
werner-freytag wants to merge 1 commit into
statamic:5.xfrom
werner-freytag:fix/issue-15007-5.x
Closed

[5.x] fix save crash after deleting a Bard set containing a hidden field#15010
werner-freytag wants to merge 1 commit into
statamic:5.xfrom
werner-freytag:fix/issue-15007-5.x

Conversation

@werner-freytag

Copy link
Copy Markdown
Contributor

Fixes #15007 for 5.x. See #15008 for same issue in 6.x branch.

Deleting a Bard set leaves a null node in the in-memory value, which makes forgetValue()data_delete() throw a TypeError on save. See the issue for the full root-cause analysis and reproduction.

Fix (resources/js/components/publish/Values.js)

  • missingValue(): treat a null intermediate as missing, so forgetValue() correctly bails out.
  • data_delete(): guard against non-object intermediates (and the final delete) as a safety net for all callers.

Test added in resources/js/tests/PublishValues.test.js.

@duncanmcclean

Copy link
Copy Markdown
Member

Thanks for the pull request!

Although, as per our support policy, v5 is no longer receiving bug fixes so I'm going to close this PR. If you need this fix on your site, consider using a composer patch.

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.

2 participants