Skip to content

Resolved #3998 where cloning an entry with an invalid IP address failed validation - #5362

Merged
bryannielsen merged 1 commit into
ExpressionEngine:7.devfrom
rowansentesy:bug/7.x/clone-entry-invalid-ip-address
Oct 19, 2026
Merged

bryannielsen merged 1 commit into
ExpressionEngine:7.devfrom
rowansentesy:bug/7.x/clone-entry-invalid-ip-address

Conversation

@rowansentesy

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #3998 / #4001. Programmatic entry creation (migrations, Model make() without setting ip_address, some add-ons) can persist MySQL’s default 0, which is not a valid IP. Normal Edit/Save still works because partial validation skips an unchanged IP field. Clone is the known CP friction point: it setId(null)s and full-validates as a new entry while inheriting the source IP, so an invalid source IP blocks clone even though IP is not a form field.

This change stamps the cloner’s session IP during CLONING_MODE (same as Publish::create()), with a fallback to ee()->input->ip_address() if session IP is empty. The new cloned row gets a valid IP. The original entry’s ip_address is not modified.

How to reproduce

  1. Ensure cloning is enabled for a channel.
  2. Set any entry’s exp_channel_titles.ip_address to '0' (simulates programmatic/legacy creates).
  3. Clone that entry in the Control Panel.
  4. Before fix: validation fails with ip_address: This field must contain a valid IP.
  5. After fix: clone succeeds (“Entry Created” / new cloned entry). Source entry IP remains '0'; new entry IP is the current CP session IP.

Test plan

  • Clone entry with ip_address = '0' succeeds after fix (verified on Exida local)
  • New cloned entry gets session IP; original entry IP unchanged
  • Clone of a healthy entry still succeeds; cloned row IP is the cloner session IP
  • Normal Edit/Save of an entry with ip_address = '0' does not rewrite IP
  • Create path unchanged

Resolves #3998

Made with Cursor

Clone creates a new entry but inherited invalid source IPs (e.g. MySQL default 0 from programmatic creates) fail full validation. Match Publish::create() and set the cloner IP during CLONING_MODE.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

CLAassistant commented Aug 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@TomJaeger TomJaeger added this to the 7.5.28 milestone Sep 30, 2026
@bryannielsen bryannielsen added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Oct 16, 2026
@bryannielsen
bryannielsen merged commit 17dac2a into ExpressionEngine:7.dev Oct 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can get a 'hidden' validation warning trying to clone if exp_channel_titles missing ip

4 participants

Sponsor
SponsoredKunjungi sekarang
Promo