- Issue created by @VladimirAus
- @vladimiraus opened merge request.
- Status changed to Needs review
over 1 year ago 4:05pm 4 March 2023 - Status changed to RTBC
about 1 year ago 7:26pm 29 May 2023 - πΊπΈUnited States Chris Matthews
Manually tested by:
Installing drupal 10.0.9
Installing block_class (dev-2.0.x b1f185f)
(At /admin/config/content/block-class/settings, 'Enable auto-complete' was already enabled by default)
Adding a class to a block resulted in:TypeError: array_merge(): Argument #1 must be of type array, null given in array_merge() (line 193 of /code/web/modules/contrib/block_class/src/Service/BlockClassHelperService.php).
Repeating above but with the patch applied did not throw this error so confidently setting to RTBC.
- Status changed to Needs review
27 days ago 10:51pm 31 May 2024 - π«π·France DYdave
Thanks everyone for creating this ticket and your code contributions, it's greatly appreciated!
I've taken a quick look at this issue and tried repeating the steps described in the IS and at #5 but unfortunately I was unable to reproduce the problem and prompt the PHP error message:
β No crash: Everything worked fine/as expectedTested with:
- drupal/core: 10.2.5
- drupal/block_class: 'dev-2.0.x:e03fb6a61296eb8ae595bfc8298e33e633a57610'
Step 1: Install module block_class from scratch (no prior config):> drush en block_class [success] Successfully enabled: block_class > drush cget block_class.settings _core: default_config_hash: XEpuHrBp3DELKxVx0tmwE6CS7NSIKXu4F6QhT_vwqd0 block_classes_stored: { } default_case: standard enable_attributes: true enable_auto_complete: true enable_id_replacement: true enable_special_chars: false field_type: multiple_textfields filter_html_clean_css_identifier: '' items_per_page: 50 qty_attributes_per_block: 10 qty_classes_per_block: 10 maxlength_attributes: 255 maxlength_block_class_field: 255 maxlength_id: 255 weight_attributes: 0 weight_class: 0 weight_id: 0
As you can see
block_classes_stored: { }
is an array, so it seems it "should" have an empty array[]
as its default value and notnull
.Additionally, is seems auto-complete is enabled by default as well:
enable_auto_complete: true
.See current:
block_class.settings.yml
https://git.drupalcode.org/project/block_class/-/blob/e03fb6a61296eb8ae5...
Step 2: Browse to "Main page content" (
system_main_block
) edit form:
/admin/structure/block/manage/olivero_content
Step 3: Add a class in autocomplete field "CSS class", for example: 'testingBC1', then save.
I'm not sure if I'm missing anything here, but with a fresh
'drupal/block_class:2.0.x-dev@dev'
module install I was not able to reproduce the error.
Could someone please take another look at this issue and let us know if the problem is still affecting the latest 2.0.x DEV code base?For reference, it seems the default value of the
block_classes_stored
config was updated in β¨ Storing block_classes_stored as a string value leads to poor developer experience Fixed .
Lastly, I'd like to point out the steps outlined above should actually be the same ones executed in module's Functional tests for the Create ("add") block form:
/admin/structure/block/add/system_main_block/olivero
.
which all seem to be passing at the moment: π’- 2.0.x build at e03fb6a: https://git.drupalcode.org/project/block_class/-/pipelines/186710
- PHPUnit job, passed: https://git.drupalcode.org/project/block_class/-/jobs/1734345
Code in test class:
https://git.drupalcode.org/project/block_class/-/blob/e03fb6a61296eb8ae5...
We would greatly appreciate if anyone could help confirming the problem in this ticket has been resolved in current DEV, or if it is still active, in which case, more contextual information would be very helpful.
Thanks in advance for your tests, reporting, comments and feedback.