summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/block/block.module12
-rw-r--r--modules/block/block.test8
2 files changed, 14 insertions, 6 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 13140de00..efcb6ef07 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -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
diff --git a/modules/block/block.test b/modules/block/block.test
index 71d265abb..417a18d5f 100644
--- a/modules/block/block.test
+++ b/modules/block/block.test
@@ -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('');