Hello,

When a user tries to create a content type that has FileField CCK field, the following error is generated:

warning: preg_match() expects parameter 2 to be string, array given in /usr/webserver/content/drupal/docs/includes/bootstrap.inc on line 723.

The node creation page still displays, but if the user tries to upload a file the following errors are generated:

The selected file sample_file.txt could not be uploaded. Only files with the following extensions are allowed: .
warning: preg_match() expects parameter 2 to be string, array given in /usr/webserver/content/drupal/docs/includes/bootstrap.inc on line 723.

It also appears that the node is trying to be saved at the same time. The first error also seems incorrect, as when adding the file upload field to this particular content type, I left the "allowed extensions" field blank, so all extensions should be allowed.

Previously, I was using version 6.x-1.0-beta2 of FileField, and none of these errors occured.

Any assistance would be greatly appreciated. Thanks!

CommentFileSizeAuthor
#9 sikirinsat15.png177.32 KBkorayal

Comments

deciphered’s picture

I can confirm this.

If you define file types allowed to be uploaded it will eliminate the second error, but it's still the wrong behavior.

upupax’s picture

Same for me..

william_frane’s picture

Title: FileField won't allow upload » FileField won't allow upload - gives warning: preg_match() expects parameter 2 to be string ...

(Just changing the title to be more descriptive, since I noticed that someone else made a duplicate thread regarding this error.)

Stoke’s picture

Same here.

It seems that v3.x does not work at all :/

deciphered’s picture

@Stoke - I beg to differ, it has some issues, but it's far from not working at all. As I mentioned, you can still upload, you just have to define allowed extensions first.

mistresskim’s picture

Declaring the allowable extensions still results in the bootstrap error, which is obviously not a good thing. I think I will go back to 6.1 in the meantime, if that's possible.

deciphered’s picture

I believe the bootstrap error was fixed in the last nightly build, I'm not entirely positive as I wasn't looking for it until a fair while after I updated.

As for the extensions issue, I submitted a patch that fixes the issue: #286972: Fix $extensions validation to enable any file if extensions left blank

dopry’s picture

Status: Active » Closed (fixed)

this should be fixed in HEAD.

korayal’s picture

StatusFileSize
new177.32 KB

I'm still having this problem, when I try to upload an image (using imagefield) the edit page refreshes, all the other fields remove their content, and I can see the image preview on that page.

Here is a screenshot in the attachment.

wuf31’s picture

Status: Closed (fixed) » Active

I'm not sure if this has anything to do with imagefield or filefield, but i'm also experiencing this.

Take a look at #285391: Recoverable fatal error in bootstrap.inc.
I post a debug_backtrace there.

Thanks for any help

drewish’s picture

Status: Active » Closed (fixed)

on the issue wuf31 referenced he'd indicated the problem was custom code.

ruralrooster’s picture

Any fix for this. I am getting this with the newest versions of 6.x and cck and filefield....

WhiplashInfo’s picture

This is a problem for me to:

"warning: preg_match() expects parameter 2 to be string, array given in /home/web25518/domains/fmedk.se/public_html/d/includes/bootstrap.inc on line 777."

RaRi’s picture

subscribe

savinsur’s picture

subscribe