flow-development-collection icon indicating copy to clipboard operation
flow-development-collection copied to clipboard

BUG: `autoload` option bugged in objects yaml since 2011 :D

Open mhsdesign opened this issue 1 year ago • 0 comments

While testing https://github.com/neos/flow-development-collection/pull/2956 i found out that flow crashes with:

parseAutowiring: Invalid autowiring declaration "off" in source configuration of package Neos.Flow, definition for object "DateTime".

At first i was more confused by the mention of DateTime, that its A returned from registerClassFiles AND that we declare an Objects.yaml for it?? https://github.com/neos/flow-development-collection/blob/416af2575b6160a249466cb5e3f56157d0a61691/Neos.Flow/Configuration/Objects.yaml#L10-L12

But it turns out that the method parseAutowiring was made stricter in the mentioned pr and currently allows also "off":

https://github.com/neos/flow-development-collection/blob/2a46c5fb3a7e0c0e439c47c702f2f41cf7e915be/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L316-L321

I know that switch in php are loose comparison == and thought at first "off" == false but the falsy string are "0" and "".

What really happens is that ANY truthy string will pass the check and turn auto-wiring ON!!

That includes the strings "off" "on" and "nudelsuppe" ... !!! That means that, as we use "off" in our flow configuration code, is was useless all the time and turned autowiring ON.

This is a regression from this change in 2011, which turned '"on"' in the switch case to true and "off" to false. https://github.com/neos/flow-development-collection/commit/0284ce6762f5bf54125ad9211895a8416b763872#diff-8a640f9bc0ed3edffb3f01425b0206a17d9ece5c16d04d8cca4c043ee6ca19f6R243

mhsdesign avatar Feb 05 '24 19:02 mhsdesign