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

grandivory’s picture

Thomas,

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.

thomas@explose.lu’s picture

Thanks 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 :

node/1234 (returns false because it is not an alias)
articles/* (returns false because it has wildcard)

So, if a block has a multiline specific pages visibility setting :

news/category/*
node/570

There will be a duplicate entry insert in the db.
Kind regards.

grandivory’s picture

I'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.

grandivory’s picture

I'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.

grandivory’s picture

Status: Active » Closed (fixed)