Closed (fixed)
Project:
Block Manager
Version:
7.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Dec 2013 at 17:50 UTC
Updated:
13 Feb 2014 at 18:12 UTC
Jump to comment: Most recent
Hello,
When enabling a region in the Block Manager configuration, I get an error :
Integrity constraint violation: 1062 Duplicate entry '265--region-mytheme' for key 'PRIMARY'
It is because the method used to generate the 'url' parameter always returns an empty result.
Indeed, I don't know why but drupal_lookup_path() always returns FALSE.
Also, if the 'page' parameter has a wildcard like 'articles/category/*', drupal_lookup_path() wouldn't work.
Any idea on a way to extract a correct url parameter?
Thanks.
Kind regards.
Comments
Comment #1
grandivory commentedThomas,
I've looked over the code that I use to gather the 'url' parameter - I can't imagine why it's returning false. I'm using two built-in drupal functions - current_path() and drupal_get_path_alias(); neither of these should ever return false.
Can you give me some more information on your configuration, installed modules, etc.? If you're able to give me the minimum configuration needed to reproduce the error on my end, I'll do my best to track it down and fix it for you.
Comment #2
thomas@explose.lu commentedThanks for your answer,
Sorry for the lack of info in my previous post.
The problem appears in the _block_manager_copy_block_db() function on line 594 of block_manager.admin.inc
The drupal_lookup_path function returns a result if the $page parameter is an alias of an existing node. But if $page is something like this, which is possible in a path context :
So, if a block has a multiline specific pages visibility setting :
There will be a duplicate entry insert in the db.
Kind regards.
Comment #3
grandivory commentedI've made a temporary commit to the dev version of my module that simply checks if $url is false before adding an entry to the database. That should prevent the bug for now, but I want to create a better method of generating the proper urls before I pull the change into a release version.
Comment #4
grandivory commentedI've made another dev commit where I use menu_get_path() to check if a given path is already a valid system path before trying to get a system path from the alias. This should allow more entries to carry over from the block module to the block_manager module when a region is enabled in block_manager. If everything looks good from this commit, I'll pull the latest changes into a new release soon.
Comment #5
grandivory commented