-
-
Notifications
You must be signed in to change notification settings - Fork 165
Correctly support the default callback on tagged services #8361
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
base: 5.3
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default
field does not work the same way as the callback fields. It only supports a value or an instance of Closure
:
contao/core-bundle/contao/drivers/DC_Table.php
Lines 738 to 745 in e55f40a
$default = $v['default']; | |
if ($default instanceof \Closure) | |
{ | |
$default = $default($this); | |
} | |
$this->set[$k] = \is_array($default) ? serialize($default) : $default; |
And an array with object and method does not match this requirement: https://3v4l.org/QKX9q It would simply be serialized to a string.
Should we fix this to support an array like any other callback in the DCA then? |
That would be a new feature then, wouldn't it? |
Yes and it would conflict with currently allowed values. 680120c should fix this by wrapping in a closure. |
I'm not sure about his. Why do we have to handle arrays at all costs? Value or closure has worked fine so far. @contao/developers /cc |
I think for consistency all DCA callbacks should work the same. But the current state of this PR doesn't change this anyway, does it? For |
see #8340