This great module show me an error with php 5.3 and Pressflow when I upload a file.

Any fix?

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kingandy’s picture

Status: Active » Needs review
FileSize
500 bytes

When this cropped up in Drupal Core (#360605: PHP 5.3 Compatibility), the core team came to the conclusion that since 6.x is no longer the "active" Drupal version, and support for it will likely be dropped long before PHP actually removes this function, the best resolution is simply to suppress the error message.

This is easy enough - just go to line 734 of filefield.module and add a '@' immediately before the ereg_replace function.

    $regex = '/\.('. @ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';

Attached is a patch that will do this for you.

superfedya’s picture

Thanks for the fix.

TravisCarden’s picture

I agree with the approach, and the fix works of course, but the patch doesn't apply. Here's one that does.

gateway69’s picture

was this patch commited, I found myself in the same situation today when clearing errors in db log..

quicksketch’s picture

No it hasn't been committed. Drupal 6 itself doesn't run real great on PHP 5.3+, but this should be applied in any case. FileField isn't receiving regular updates but I'll include this one in the next version when I go through the queue.

quicksketch’s picture

No it hasn't been committed. Drupal 6 itself doesn't run real great on PHP 5.3+, but this should be applied in any case. FileField isn't receiving regular updates but I'll include this one in the next version when I go through the queue.

petew’s picture

I would prefer we update the function call to something which isn't deprecated, rather than just hiding the error.

Patch attached which contains a switch to using preg_replace().

It's a simple change, but let me know if it needs work.

petew’s picture

Apologies, that patch probably won't apply in it's current state purely due to the file location.

I'll try and create an appropriate one using the normal Drupal git method.

petew’s picture

Ok, so, more hast less speed.

Attached is a normal Drupal project patch file.

quicksketch’s picture

Status: Needs review » Closed (won't fix)

We can't change the API on developers at this point in the release and there's not signifant reason to make a 4.x release just for this purpose.

quicksketch’s picture

Status: Closed (won't fix) » Needs review

Oops sorry. The patch in #3 really should still be committed.

petew’s picture

Agreed. I only submitted the patch as I finally felt compelled to fix it after having the message continually appear, and thought i'd provide a patch back.

Patch #3 looks good, but as it's nearly a year and hasn't been committed I wonder whether it hadn't been accepted/committed due to it continuing with the deprecated function instead of updating to the PHP recommended replacement. Hence the alternate patch.

Whilst I don't agree with the approach of hiding the deprecated functions rather than updating to the supported language alternative functions, this does sadly appear to be Drupal way, and as such patch #3 would be good. I overlooked that there are still occurrences of ereg_replace hidden away in D6 core. (and maybe other deprecated functions, I haven't looked in detail)

Anyway, thanks, if #3 could be committed that would be great.

Sorry to bump this issue thread after all this time.

quicksketch’s picture

Status: Needs review » Reviewed & tested by the community

No worries, it's my bad for not having committed this already. I've largely stopped doing any D6-only development work; which has in turn let FileField languish because I no longer have any D6 sites. I'll go through the queue and get all these RTBC patches at some point. RTBC for #3.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Committed #3. Sorry for the delay on this guys. I'll try to get a new release out this week.

Status: Fixed » Closed (fixed)

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