I'm trying to attach an uploaded file as an email attachment using Webform and Mimemail.
After submitting a webform I get the following error 20 times:
Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in file_scan_directory() (Zeile 2035 von /path/to/drupal/includes/file.inc).

The mail is sent correctly with the attached file, though.
Any ideas?

Comments

nerdacus’s picture

I encountered this exact warning when (un)subscribing to Simplenews newsletters as an anonymous user, but sending out the newsletter e-mails triggered no warning.

After reading #954594: Warning: preg_match(): No ending delimiter '^' found in file_scan_directory() (line 1969 of file.inc). and backtracing, I discovered that the function template_preprocess_mimemail_message() passes '^mail\.css*$' as $mask into file_scan_directory(), while preg_match is expecting $mask to be proper regex string. Simply adding forward slashes (/) on the ends of the string so that it reads '/^mail\.css*$/' on line 95 in mimemail/theme/mimemail.theme.inc halted all warnings of this nature.

Hope this helps. Sorry I'm too busy to set up a proper environment to create/test patches.

-Marcus

awagner’s picture

Status: Active » Needs review
StatusFileSize
new710 bytes

Hi,

You can find attached to this comment a patch that solves the issue.
Hope this will help you.

Alex

arnested’s picture

The patch form #2 works for me.

sgabe’s picture

Title: Error when used with Webform: Warning: preg_match() [function.preg-match] » Missing delimiter in file_scan_directory()
Status: Needs review » Fixed

Thanks, committed to both branches!

sgabe’s picture

Ehh...reverted from D6 since in that case file_scan_directory() uses ereg() and not preg_match().

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.