[drupal-devel] [bug] block on front page causes regex error
FloydM
drupal-devel at drupal.org
Wed Jul 20 02:52:57 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: FloydM
Status: patch
Good deal. Thank you, clydefrog (and thank you HellRaider for the
patch).
FloydM
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?
------------------------------------------------------------------------
Mon, 18 Jul 2005 21:14:59 +0000 : drumm
Code looks good. I can see how this might be a problem. +1
(I didn't try running with this patch)
------------------------------------------------------------------------
Tue, 19 Jul 2005 20:33:25 +0000 : FloydM
I applied the patch and it fixed the problem for me. Thank you much!
This is the first bug I've submitted here and I want to make sure the
fix gets merged in.
Should I change the status of this post to fixed?
------------------------------------------------------------------------
Tue, 19 Jul 2005 23:04:38 +0000 : clydefrog
FloydM: The status is changed to fixed only when/if the patch is
applied.
More information about the drupal-devel
mailing list