diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-22 22:08:43 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-22 22:08:43 +0000 |
commit | 9a2c9fee0466bb2aa98df9dd9d5edf21f0cf6896 (patch) | |
tree | 20c4f852f598500cdcae6b064e1d9f486b85d953 | |
parent | 10a34b84c08161f5ab7c2142d2cd45e34c10dc59 (diff) | |
download | brdo-9a2c9fee0466bb2aa98df9dd9d5edf21f0cf6896.tar.gz brdo-9a2c9fee0466bb2aa98df9dd9d5edf21f0cf6896.tar.bz2 |
#368093 by emosbaugh, kirkage, naxoc, alexpott, et al: Fixed Block visibility settings are case sensitive.
-rw-r--r-- | modules/block/block.module | 12 | ||||
-rw-r--r-- | modules/block/block.test | 8 |
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(''); |