E_WARNING when adding/editing a price set field
It appears to have started in 5.28, and I can reproduce on dmaster.demo.
To reproduce either add or edit a price set field, but either turn off popups or open in new tab otherwise the error is snippet'd out.
Warning: Illegal string offset 'required' in CRM_Core_Form->addRequiredAttribute() (line 1188 of .../CRM/Core/Form.php).
It's related to https://github.com/civicrm/civicrm-core/commit/77f68d88d633394c2ec17a5bbc77361620aa38bd but I'm not sure if it's just that. However it seems clear that $attributes
, which is the same field as $extra
earlier on, can be NULL, which is causing the error when it tries to do $attributes['required']
, but then even ignoring that the code doesn't seem like it would ever work anyway. It's a local variable passed by value, so setting it to 1 in the function does nothing.
private function addRequiredAttribute($required, $attributes) {
$required ? $attributes['required'] = 1 : NULL;
}
I'm also confused by the fact that this warning should be coming up much more often based on my read of the add() function, but it doesn't seem to be. So I'm trying to assess the scope.