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

drumm drupal-devel at drupal.org
Mon Jul 18 21:15:03 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:   drumm
 Status:       patch

Code looks good. I can see how this might be a problem. +1
(I didn't try running with this patch)




drumm



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

Sat, 02 Jul 2005 04:54:18 +0000 : 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.




------------------------------------------------------------------------

Mon, 18 Jul 2005 06:54:01 +0000 : HellRaider

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 {




------------------------------------------------------------------------

Mon, 18 Jul 2005 09:01:18 +0000 : Dries

Can you upload your patch?




------------------------------------------------------------------------

Mon, 18 Jul 2005 20:47:15 +0000 : HellRaider

Attachment: http://drupal.org/files/issues/block_3.patch (850 bytes)

Sorry, here's the attachment.
I wasn't fully aware of the procedures. I'm reading the contributor's
guide now...


Did I get everything right this time?







More information about the drupal-devel mailing list