Commit 9a2c9fee authored by webchick's avatar webchick
Browse files

#368093 by emosbaugh, kirkage, naxoc, alexpott, et al: Fixed Block visibility...

#368093 by emosbaugh, kirkage, naxoc, alexpott, et al: Fixed Block visibility settings are case sensitive.
parent 10a34b84
......@@ -703,12 +703,16 @@ function block_block_list_alter(&$blocks) {
// Match path if necessary.
if ($block->pages) {
// Convert path to lowercase. This allows comparison of the same path
// with different case. Ex: /Page, /page, /PAGE.
$pages = drupal_strtolower($block->pages);
if ($block->visibility < 2) {
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path($path, $block->pages);
// Convert the Drupal path to lowercase
$path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
// Compare the lowercase internal and lowercase path alias (if any).
$page_match = drupal_match_path($path, $pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $block->pages);
$page_match = $page_match || drupal_match_path($_GET['q'], $pages);
}
// When $block->visibility has a value of 0, the block is displayed on
// all pages except those listed in $block->pages. When set to 1, it
......
......@@ -8,6 +8,7 @@
class BlockTestCase extends DrupalWebTestCase {
protected $regions;
protected $admin_user;
public static function getInfo() {
return array(
......@@ -23,12 +24,12 @@ class BlockTestCase extends DrupalWebTestCase {
// Create and log in an administrative user having access to the Full HTML
// text format.
$full_html_format = db_query_range('SELECT * FROM {filter_format} WHERE name = :name', 0, 1, array(':name' => 'Full HTML'))->fetchObject();
$admin_user = $this->drupalCreateUser(array(
$this->admin_user = $this->drupalCreateUser(array(
'administer blocks',
filter_permission_name($full_html_format),
'access administration pages',
));
$this->drupalLogin($admin_user);
$this->drupalLogin($this->admin_user);
// Define the existing regions
$this->regions = array();
......@@ -177,6 +178,9 @@ class BlockTestCase extends DrupalWebTestCase {
$this->drupalGet('user');
$this->assertNoText($title, t('Block was not displayed according to block visibility rules.'));
$this->drupalGet('USER/' . $this->admin_user->uid);
$this->assertNoText($title, t('Block was not displayed according to block visibility rules regardless of path case.'));
// Confirm that the block is not displayed to anonymous users.
$this->drupalLogout();
$this->drupalGet('');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment