Skip to content

Fix PHP warnings when clone field encounters invalid field entries#286

Merged
cbravobernal merged 2 commits intotrunkfrom
fix/clone-with-invalid-fields
Dec 16, 2025
Merged

Fix PHP warnings when clone field encounters invalid field entries#286
cbravobernal merged 2 commits intotrunkfrom
fix/clone-with-invalid-fields

Conversation

@priethor
Copy link
Contributor

What

Fix PHP warnings in the Clone field when the field array contains null or invalid entries.

Reported in the forum: https://wordpress.org/support/topic/php-warnings-207/

Why

Users migrating from ACF to SCF, which includes PRO functionality, can encounter PHP warnings they didn't have before

How

  • Added defensive null/array check before accessing field properties in acf_get_fields() method
  • Added unit tests to verify the fix and prevent regression

Testing Instructions

  • Create a field group with clone fields and verify no PHP warnings appear during normal usage
  • Run vendor/bin/phpunit --filter Test_ACF_Field_Clone

@priethor priethor self-assigned this Dec 16, 2025
@priethor priethor added the [Type] Bug Something isn't working label Dec 16, 2025
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 12.21%. Comparing base (bc8891e) to head (4ff6ac6).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #286      +/-   ##
============================================
+ Coverage     12.09%   12.21%   +0.12%     
- Complexity     4285     4287       +2     
============================================
  Files           284      284              
  Lines         34692    34693       +1     
============================================
+ Hits           4195     4239      +44     
+ Misses        30497    30454      -43     
Flag Coverage Δ
e2e 30.68% <ø> (-0.03%) ⬇️
javascript 2.53% <ø> (ø)
phpunit 7.57% <100.00%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Dec 16, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor, cbravobernal.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Contributor

@cbravobernal cbravobernal left a comment

Choose a reason for hiding this comment

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

LGTM

@cbravobernal cbravobernal merged commit e95c153 into trunk Dec 16, 2025
10 of 11 checks passed
@priethor priethor deleted the fix/clone-with-invalid-fields branch December 16, 2025 13:42
@cbravobernal cbravobernal added this to the 6.8.0 milestone Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants