processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

Something is setting Field::flagSystemOverride on non-system fields

Open Toutouwai opened this issue 1 year ago • 1 comments

Short description of the issue

Sorry that this issue description isn't more specific but I don't know what is causing it.

When I want to get user-created fields (i.e. non-system fields) I look for fields that don't have any flags set.

$non_system_fields = $fields->find("flags=0");

For a while now I've noticed that some non-system fields are being missed, and on investigation I find that these fields have Field::flagSystemOverride set. The thing is, I've never intentionally set this flag on these fields so I think it must be something in the core that's doing it.

Here's an example from an almost completely clean PW 3.0.238 installation with the blank profile.

All I've done is:

  • Install TracyDebugger
  • Install ModuleSettingsImportExport (so I can import my preferred Tracy settings)
  • Turn $config->debug on
  • Turn $config->advanced on (maybe the culprit?)
  • Create a "text_1" field and add it to the basic page template.

2024-05-12_145047

Setup/Environment

  • ProcessWire version: 3.0.238

Toutouwai avatar May 12 '24 02:05 Toutouwai

I can confirm Robin's findings. It looks like these lines in ProcessField.module set an override flag:

			} else if($name === 'system' && $config->advanced) {
				if(!$input->post('system')) {
					$this->field->flags = $this->field->flags | Field::flagSystemOverride;
					$this->field->flags = $this->field->flags & ~Field::flagSystem;
				} else {
					$this->field->flags = $this->field->flags | Field::flagSystem;
				}
				continue; 

matjazpotocnik avatar May 12 '24 05:05 matjazpotocnik

Thanks @Toutouwai @matjazpotocnik I've pushed a fix for this.

ryancramerdesign avatar May 17 '24 16:05 ryancramerdesign

Thanks

Toutouwai avatar May 17 '24 22:05 Toutouwai