Closed (fixed)
Project:
Webform
Version:
8.x-5.25
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
7 Apr 2021 at 15:16 UTC
Updated:
11 May 2021 at 12:54 UTC
Jump to comment: Most recent, Most recent file
WebformBlock.php > build() function can return NULL instead of an array. If other functions have strict type checking for the output of the function it will cause an error.
$content = $webform_block->build();
test($content);
function test(array $content) {
//do something;
}
Since Drupal/Core/Block/BlockPluginInterface.php specifies an array is returned, this function should do so rather than other functions accepting array or NULL.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Screenshot from 2021-04-23 13-33-29.png | 177.29 KB | marcusvsouza |
| #4 | 3207641-block-null-return-4.patch | 521 bytes | marcusvsouza |
| #2 | 3207641-block-null-return.patch | 521 bytes | onedotover |
Comments
Comment #2
onedotover commentedComment #3
jrockowitz commentedComment #4
marcusvsouza commentedThe patch in comment # 2 has been corrupted, I made a new patch, please review it.
It is exactly the same as the previous patch, which for some reason has been corrupted.
Comment #5
jrockowitz commentedCan you please show how the patch from #2 is corrupted? The byte size is identical.
Comment #6
marcusvsouza commentedWhen I try to apply the patch the error in the image below tells me that the patch has been corrupted.
Comment #7
jrockowitz commentedThat seems specific to your system.
BTW, a good hack if you have curl is
curl https://www.drupal.org/files/issues/2021-04-07/3207641-block-null-return.patch | git apply -Comment #8
marcusvsouza commentedThe patch in the comment #2 works good using curl, thanks for the tip.
Changing to RTBC!
Comment #11
jrockowitz commentedPlease consider joining the Webform module's Open Collective to help ensure that the Webform module is maintained.