Use of underscore in environment name makes blocks not work

Ian Ward - November 6, 2009 - 13:53
Project:Faceted Search
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

When there's an underscore in the "name" for your faceted search environment, blocks will not get loaded. This is a result of the following code:

<?php
elseif ($op == 'view' && user_access('use faceted search')) {
   
// Determine the environment id and requested block.
   
list($env_name, $delta) = explode('_', $delta, 2);

   
$env = faceted_search_env_load($env_name);
?>

If your environment name is "foo_bar" then $env_name will get set to just "foo", causing the faceted_search_env_load to fail, or, load the wrong environment (in this case it would try and load an environment called "foo").

Changing the "limit" in the explode call from 2 to 1 seems to fix the issue, but I'm not positive whether this causes problems in other naming schemes; I do not see why "2" is used as the limit in the first place.

 
 

Drupal is a registered trademark of Dries Buytaert.