Cms: Deprecation warning after updating to 3.1.31

Created on 19 Jun 2019  路  9Comments  路  Source: craftcms/cms

Description

After updating to 3.1.31 this deprecaation warning pops up:

ThedefineComponentsevent on CraftVariable has been deprecated. Use theinitevent to register custom components instead.
Called from /xxx/vendor/craftcms/cms/src/web/twig/variables/CraftVariable.php:139

This warning comes up on all my Craft projects., even with all plugins disabled.

Steps to reproduce

  1. Update from 3.1.30 to 3.1.31

Additional info

  • Craft version: 3.1.31
  • PHP version: 7.2

Most helpful comment

Turns out this happens when the Debug Toolbar is enabled, which registers a wildcard event.

I鈥檝e removed the check for that event for the next Craft 3.2 Beta release, so those deprecation errors will go away after that.

All 9 comments

Yii 2.0.20 included a fix for wildcard event handlers, which could have something to do with this.

I know you said you disabled all your plugins, but do you have a module that may be registering a wildcard event perhaps?

Turns out this happens when the Debug Toolbar is enabled, which registers a wildcard event.

I鈥檝e removed the check for that event for the next Craft 3.2 Beta release, so those deprecation errors will go away after that.

@brandonkelly will this be fixed also be applied to 3.1? We're not in a position to update to 3.2 yet but the deprecation error is slightly annoying!

@lukeyouell This is already fixed in 3.2 and I guess this will not be fixed in 3.1.

@elfacht I can appreciate that, but bug fixes such as this shouldn't just be applied to 3.2 as they affect projects using 3.1 too.

@lukeyouell 3.1 is not an LTS release or anything.

@brandonkelly Thanks. Is there a reason why it isn't?

The reason we aren't in a position to update is due to the bugs associated with the new features that ship with 3.2, it just doesn't look to be stable enough _yet_, which is understandable considering it was only released a week ago.

I do think there's a case for 3.x releases to receive short-term support in the form of minor bug/security fixes, at least until the latest release is tried-and-tested.

There鈥檚 definitely a case for us establishing a LTS program, but 3.1 isn鈥檛 one.

Plus in this case, this deprecation error can safely be ignored. The fix was a slight breaking change, which is why I made it for 3.2.0 rather than a 3.1.x release.

@brandonkelly Yeah the deprecation issue is minor. I think my initial point developed into a wider question! Thanks for explaining!

Was this page helpful?
0 / 5 - 0 ratings