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

[5.0.0-alpha.6]: Invalid field handle on re-install #14166

Closed
WHITE-developer opened this issue Jan 19, 2024 · 4 comments
Closed

[5.0.0-alpha.6]: Invalid field handle on re-install #14166

WHITE-developer opened this issue Jan 19, 2024 · 4 comments
Assignees
Labels

Comments

@WHITE-developer
Copy link

WHITE-developer commented Jan 19, 2024

What happened?

Description

When trying to setup a clean database with existing project-config, you get an Exception: Invalid field handle: {customFieldHandle} when you have used fields where you have renamed the handle inside a fieldlayout.

cms/src/base/Element.php

Lines 5837 to 5840 in 5dd7cb7

// ignore if it's not a custom field handle
if (!isset(CustomFieldBehavior::$fieldHandles[$handle])) {
return null;
}

here the CustomFieldBehavior::$fieldHandles is only returning the field handles as defined in settings -> fields, not the handles you have defined in the field layout editors.

Steps to reproduce

  1. setup a clean Craft 5 project
  2. Create a custom field and map this to an entry type
  3. start with a clean DB
  4. run ./craft install
  5. fill in the required info
  6. when applying the existing project config the Exception will be thrown

Expected behavior

Existing project config should be getting applied

Actual behavior

An Invalid field handle exception is thrown

Craft CMS version

5.0.0-alpha.6

PHP version

8.3.2

Operating system and version

Ubuntu 22.04

Database type and version

8.0.35

Image driver and version

No response

Installed plugins and versions

@brandonkelly
Copy link
Member

I’m not able to reproduce that. Can you please send your Composer and project config files to [email protected]?

@lukas-jansen
Copy link

Retried it by first rebuilding config files but still got it,
So started from a completely clean project with no plugins installed and just 1 custom field, but still got it.

When not renaming/rehandling the custom field it all works fine

I've send my project yamls and composer files by mail

@i-just
Copy link
Contributor

i-just commented Jan 23, 2024

Thanks for all the info and the files. I can replicate this issue. It only happens if the field with the changed handle is part of an entry type that is assigned to a single type section. I'm working on a solution for this.

@brandonkelly
Copy link
Member

Craft 5.0.0-alpha.9 was just released with a fix for this. Thanks again!

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

No branches or pull requests

4 participants