Due to #1172560: The block X was assigned to the invalid region Y and has been disabled. it is possible that $block['status'] is used in _block_rehash() before it is ensured to exist.

Files: 
CommentFileSizeAuthor
#14 block-rehash-1851530-14.patch1.65 KBJvE
PASSED: [[SimpleTest]]: [MySQL] 40,728 pass(es).
[ View ]
#6 1851530-undefined-index-status-block-rehash.patch915 bytesjcovington
PASSED: [[SimpleTest]]: [MySQL] 40,392 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new1.68 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch block-rehash-1851530-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

A simple patch.

Status:Needs review» Needs work

The last submitted patch, block-rehash-1851530-1.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.71 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch block-rehash-1851530-3.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Hm, patch corrupt? Let's try again.

#3: block-rehash-1851530-3.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, block-rehash-1851530-3.patch, failed testing.

Version:8.x-dev» 7.x-dev
StatusFileSize
new915 bytes
PASSED: [[SimpleTest]]: [MySQL] 40,392 pass(es).
[ View ]

This is a patch for block.module, to avoid an error against checking for $block['status']. I made the fix in 7.x. Should it also be made for 8.x?

Status:Needs work» Needs review

Marking this issue for review per the patch submitted.

Version:7.x-dev» 8.x-dev
Status:Needs review» Needs work

+++ b/modules/block/block.module
@@ -432,7 +432,7 @@ function _block_rehash($theme = NULL) {
-      if (!empty($block['region']) && $block['region'] != BLOCK_REGION_NONE && !isset($regions[$block['region']]) && $block['status'] == 1) {
+      if (!empty($block['region']) && $block['region'] != BLOCK_REGION_NONE && !isset($regions[$block['region']]) && 1 == $block['status']) {

I do not see how this would solve anything.
Also yes, issues should be fixed in 8.x first.

@JvE, as I understand it, the error being thrown was due to trying to check for the value of $block['status'] in cases where $block['status'] is undefined. One quick solution is to reverse the equality check so that $block['status'] can be undefined without throwing any errors.

One quick solution is to reverse the equality check so that $block['status'] can be undefined without throwing any errors.

I'm sorry but you are mistaken. Where did you get that idea?

Hm. When I made the change, I didn't see any errors printed to the admin page when enabling the devel module (which is how I came to be aware of this issue). But I see now when I monitor my logs that a notice is still shown. Sorry for the misinformation and I'll keep looking at this.

I wish I had time to help out :(
I think the patch from #3 can easily be made to apply to D7.

Version:8.x-dev» 7.x-dev
Issue summary:View changes

I don't think this is an issue for 8.x anymore

    $status = $block->status();
    // Disable blocks in invalid regions.
    if (!empty($region) && $region != BlockInterface::BLOCK_REGION_NONE && !isset($regions[$region]) && $status) {

New status() method on the ConfigEntity and the status property is guaranteed to exist.

Status:Needs work» Needs review
StatusFileSize
new1.65 KB
PASSED: [[SimpleTest]]: [MySQL] 40,728 pass(es).
[ View ]