- 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.

CommentFileSizeAuthor
#3 block_3.patch850 bytesThiago Bastos
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Thiago Bastos’s picture

Status: Active » Needs review

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 {
Dries’s picture

Can you upload your patch?

Thiago Bastos’s picture

FileSize
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?

drumm’s picture

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

fmann’s picture

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?

ezheidtmann’s picture

FloydM: The status is changed to fixed only when/if the patch is applied.

fmann’s picture

Good deal. Thank you, clydefrog (and thank you HellRaider for the patch).

Stefan Nagtegaal’s picture

I can confirm that this patch works as it should, had the same errors FloydM when trying to put a block on the frontpage of my site..
Good catch HellRaider! :-)

Dries’s picture

HellRaiser, thanks for attaching the patch. You got it right. :) Committed to HEAD and DRUPAL-4-6. Thanks.

Dries’s picture

Status: Needs review » Fixed
Anonymous’s picture

Anonymous’s picture

ax’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)