[drupal-devel] [bug] block on front page causes regex error

HellRaider drupal-devel at drupal.org
Mon Jul 18 06:54:04 UTC 2005


Issue status update for 
http://drupal.org/node/26217
Post a follow up: 
http://drupal.org/project/comments/add/26217

 Project:      Drupal
 Version:      4.6.2
 Component:    block.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  FloydM
 Updated by:   HellRaider
-Status:       active
+Status:       patch

Here's a patch. preg_quote(variable_get('site_frontpage', 'node'), '/')
did the trick:


@@ -470,7 +470,7 @@
       // Match path if necessary
       if ($block['pages']) {
         $path = drupal_get_path_alias($_GET['q']);
-        $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/',
'/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'.
variable_get('site_frontpage', 'node') .'\2'),
preg_quote($block['pages'], '/')) .')$/';
+        $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/',
'/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'.
preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'),
preg_quote($block['pages'], '/')) .')$/';
         $page_match = !($block['visibility'] xor
preg_match($regexp, $path));
       }
       else {




HellRaider



Previous comments:
------------------------------------------------------------------------

1120280058 : FloydM

- I create a new block with some HTML in it.
- I configure the block, setting Visibility to "Show on only the listed
pages." and list just "<front>".
- I save and get the following warning: 


warning: preg_match() [function.preg-match]: Unknown modifier '3' in
/home/www/site/modules/block.module on line 474.


The block does not show up on the front page.







More information about the drupal-devel mailing list