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

Project config switching between true/false and '1'/'0' on rebuild #4094

Open
juresrpcic opened this Issue Apr 3, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@juresrpcic
Copy link

commented Apr 3, 2019

Description

When building fields in the CP, statements in project config yaml look like this:
required: false
sortOrder: 1
etc.

When running a rebuild later (which should just leave the yaml alone), it always replaces original values with these:
required: '0'
sortOrder: '1'
etc.

This can even be seen on an empty install when using the project config as a quick start - the values switch on initial install the same way.

I'm running the config sync locally on a Windows dev environment (WinNmp - nginx, php 7.3, mysql 5.7).

This doesn't affect functionality afaik, but it makes the Git commits hard to review for actual project config changes.

Steps to reproduce

  1. Add some fields via CP
  2. Run ./craft project-config/rebuild
  3. Commit project config to Git and look at changes

Additional info

  • Craft version: Craft Pro 3.1.20.1
  • PHP version: 7.3.2
  • Database driver & version: MySQL 5.7.21
  • Plugins & versions: /
@jamesmacwhite

This comment has been minimized.

Copy link

commented Apr 4, 2019

I had a somewhat similar question and @brandonkelly provided a bit of insight into why it's happening.

#4042

I hope it explains the situation a bit.

@juresrpcic

This comment has been minimized.

Copy link
Author

commented Apr 5, 2019

Thanks @jamesmacwhite , that helps. I guess I'll make sure to run a project config rebuild before every commit then as that seems to normalize everything to MySQL string values - so I can keep the useful Git commit comparisons.

For anyone else reading this - if you're developing and don't care for keeping soft deleted items, it's better to run garbage collection before rebuilding the config (or deleted sections will find themselves back in the yaml file). This issue should get resolved soon though - #4100

So I'll run this before each commit:

./craft gc/run
./craft project-config/rebuild
@brandonkelly

This comment has been minimized.

Copy link
Member

commented Apr 5, 2019

We’re going to see if we can go through all the config array definitions and start typecasting the values from there, e.g.

$config = [
    'foo' => (bool)$model->foo,
];

So values are always consistently saved with the correct types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.