The introduction of the _ctools_block_load_blocks() function in 1.2, and more likely the code behind that function being introduced, means that you can no longer have Views define a block without having the block module enabled as the query in that function expects the block table to be present.

Ideally, the function should check if the block module is enabled before the query is executed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Deciphered’s picture

Status: Active » Needs review
FileSize
1.96 KB

Patch.

gaas’s picture

I ran into this issue on our site. It broke we when upgrading to ctools-1.2 because it tried to select from the non-existing blocks table. Applied this patch and it now works.

populist’s picture

Status: Needs review » Reviewed & tested by the community

I ran into this same problem and tested out this patch. Works great for me and seems reasonable (i.e. check to see if a module exists before querying its table).

merlinofchaos’s picture

Status: Reviewed & tested by the community » Needs work

This patch shouldn't alternately invoke hook_block_info -- CTools will already be doing that. Doing so is simply wasteful. If block.module isn't enabled, it simply shouldn't execute the query. It should be able to continue just fine without that query.

merlinofchaos’s picture

Status: Needs work » Needs review
FileSize
548 bytes

Try this simpler patch instead.

Deciphered’s picture

Status: Needs review » Needs work

@merlinofchaos,

Updated, simpler patch doesn't work, whereas mine did. The new patch gives me a bunch of errors, as such:

Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 156 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 157 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 166 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 289 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 293 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 156 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 157 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 166 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 289 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 293 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 156 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 157 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 166 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 289 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 293 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).

Basically the functions are expecting populated blocks, which I provided with a simulated alternative to the query. Open to other suggestions for the fix though.

merlinofchaos’s picture

Deciphered: Are you running the latest -dev? Because the errors you are seeing look like they'd only show up prior to http://drupalcode.org/project/ctools.git/commitdiff/03f10455c9ca38c152b3...

Deciphered’s picture

Status: Needs work » Reviewed & tested by the community

No, that was using the patch against CTools 1.2, which is my preferred method when dealing with bugs in stable releases, easy to manage in a makefile than using a commit, however for the purposes of testing this issue I should absolutely have been using the latest dev.

I have updated to the dev and using this patch, it seems to work fine. Apologies for the confusion.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed. Thanks for the testing!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

lpalgarvio’s picture

Status: Closed (fixed) » Active

this bug, or similar, seems to have resurfaced.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'care4it.dpl_block' doesn't exist: SELECT b.* FROM {block} b WHERE (b.theme = :db_condition_placeholder_0) ORDER BY b.region ASC, b.weight ASC, b.module ASC; Array ( [:db_condition_placeholder_0] => zen_care4it ) in _ctools_block_load_blocks() (line 101 of /home/care4it/public_html/sites/all/modules/contrib/api/ctools/plugins/content_types/block/block.inc).

#1842524: Error: Base table or view not found {block}

i disabled blocks since i'm using a CTools based solution, but some pages are loading system blocks.
so shouldn't be able to turn blocks off

Drupal 7.19
Chaos tool suite (ctools) 7.x-1.2
Panelizer 7.x-3.0-rc1
Panels 7.x-3.3
Panels Everywhere 7.x-1.0-rc1

merlinofchaos’s picture

Have you checked latest -dev? That function has an exit right at the top if block.module is not enabled.

lpalgarvio’s picture

Status: Active » Fixed

oh, sorry, didn't noticed that 7.x-1.2 was dated august, while the patch commited to dev is dated october.

thanks! i'll assume it's fixed.

Spleshka’s picture

Status: Fixed » Active

This solution do not solves all problems. See http://drupal.org/node/1842524#comment-7092686.

Deciphered’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Needs review
FileSize
2 KB

Re-rolled patch.

Committed patch returns nothing to the ctools_content_renderer if the Block module is disabled if you are using a Block content pane, which is not necessary. Original patch as well as this patch allows the block content to render correctly even if the Block module is disabled.

Chris Matthews’s picture

The 7 July 2015 re-rolled patch in #17 applied cleanly to the latest ctools 7.x-1.x-dev and if still applicable needs to be reviewed.

Checking patch plugins/content_types/block/block.inc...
Applied patch plugins/content_types/block/block.inc cleanly.