After updating to Drupal 6.15 and also updating a few other modules, I am getting this error on file upload + node save:
warning: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 55 in /srv/drupalmultisite/sites/all/modules/contributed/filefield_paths/filefield_paths.module on line 571
This is for different users and different file names. Is anyone else seeing this?
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 723784-filefield-regex-18.patch | 1.49 KB | andrewlevine |
Comments
Comment #1
voidberg commentedIt happens to me as well after an update to 6.15.
Comment #2
gallamine commentedI have a user that says this message appeared after he saved a node with images.
I'm running FileField Paths 6.x-1.4 and the latest Drupal release.
Comment #3
m.stentaI am also seeing this. Not sure what's causing it. I've been uploading image files provided by a client, some of which contain spaces in their titles. Doubt that has anything to do with it, but worth mentioning. I'm using the [nid] replacement pattern only.
Subscribing. I'll let you know if I notice any other patterns.
Comment #4
m.stentaI've tried it without the spaces in the titles, and it still happens. Just an FYI...
Comment #5
decipheredHi guys,
Any more information you can provide about your environments? PHP version, OS, server technology?
I'm running FFP 1.4 with D6.15 on multiple sites and have not once come across this issue.
Also, is it actually breaking anything (other than aesthetics) or is just throwing the error?
Cheers,
Deciphered.
Comment #6
kerberos commentedFor us, it doesn't seem to break anything at this point, just errors.
PHP 5.2.10-2ubuntu6.4
MySQL database 5.1.37
Ubuntu 9.10 Server (non-virtualized)
D 6.15 FFP 1.4 (now Pressflow D 6.15)
Actually, I just tried to reproduce it and it doesn't happen anymore. The only thing I think we changed was to switch from regular D6.15 to Pressflow Drupal in the mean time.
Comment #7
kerberos commentedI turns out one of our programmers disabled the error reporting for this. It, in fact, is still happening. Anything we can do to help you debug it?
-Daniel
Urbo.ro
Comment #8
B.P.B commentedI have the same error. The file renaming worked flawlessly for about 100 or so image uploads then suddenly this bug appeared. Nothing in my setup changed.
Drupal 6.16
Filefield Paths 6.x-1.4
File Replacement Pattern: [field_photo-filefield-description]-[nid].[filefield-extension-original]
Cleanup using Pathauto + Convert to lowercase
Webserver:
Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_fastcgi/2.4.6 Phusion_Passenger/2.2.5
PHP: 5.2.12
MySQL: 5.0.89
Comment #9
B.P.B commentedUPDATE...
I shut off "Cleanup using Pathauto" and the bug disappeared.
Then, to confirm, I re-enabled it, and no more bug.
Nostalgia: http://drupal.org/node/324736
Comment #10
gallamine commentedBPB, where do you find the "Cleanup using Pathauto" setting? I'm still having this issue.
Comment #11
gallamine commentedAh, I found it. It's under the field settings for the file or image field.
So, admin/content/node-type/content-type/fields/field-name
Comment #12
gallamine commentedI still get the error after turning off and on Cleanup using Pathauto.
I'm running D6.16. MySQL 5.0.41. PHP 5.2.5 128M, Apache 2. Running Linux, not sure what distro. FileField Paths 6.x-1.4
Comment #13
kerberos commentedYeah, same here. Turning it off and back on did not help.
Comment #14
gallamine commented*bump*.
Nothing?
Comment #15
gallamine commentedI just updated to the latest versions of ImageField (6.x-3.3) and FileField (6.x-3.3) and I still get this error.
Comment #16
gallamine commentedJust updated to the latest version of FileField - 6.x-3.5 and the error still appears.
Comment #17
gallamine commented*bump*
Still seeing this error. Any thoughts?
Comment #18
andrewlevine commentedIn filefield_paths_filefield_paths_process_file, there is a section that will replace the new path inside the body. I don't completely understand the use-case for this (maybe it should be entirely deleted, maybe not), but the problem is it doesn't escape the arguments being passed into regexes.
So if you have a token like [blah-blah] in the regex argument, preg functions interpret that as an invalid character range (eg [a-z]) and spits the error. The fix is to escape the arguments we pass into a regex so they are treated as regular characters.
Patch attached.
Comment #19
deciphered@andrewlevine
The usecase is that if a user copies the path from the filefield before the node has been saved and the path has been corrected and inserts it into the Body field, which would cause a broken link. This is more obviously an issue when using the Insert module or the WYSIWYG ImageField module. It is definitely a necessary function.
As for the patch, looks good, will do some testing of it and if all is well expect to see it make it's way into the 2.x branch.
Cheers,
Deciphered.
Comment #20
gallamine commentedAh ha! I've "solved" the issue. Or, at least I know what the problem is.
So, I created another ImageField with the *exact* same settings as my original. The new one, however, behaved perfectly with no warnings. After much poking around in the DB I discovered the "widget_settings" and "display_settings" fields were different between the two in the "content_node_field_instance" table. I swapped those fields (new for old) and things worked.
I thought about it for a bit, and discovered that the old "widget_settings" field had this line in there:
Hmmm ... preg_match() is a regular expression matching function, which uses "[" and "]" as special characters. So, if it's trying to match that string, that's probably what's freaking it out. I'm not sure why the new field gets created without a file_path setting, but perhaps that's by design? Anyway, at this point, I'm not sure who's problem it is, but if anyone else is having this problem, I go and manually change your "content_node_field_instance" table, and edit the table entry for your Image Field and make sure there's no weird characters in the "file_path" portion of the "widget_settings" field. I *assume* you can change it to whatever you want, but I'm not sure.
I'll make a post in the ImageField issues queue and link here and see if they have any comments.
Here's the old "widget_settings" and "display_settings":
Here's the new:
Comment #21
deciphered@gallamine
It sounds more likely that you where using an older version of FileField Paths for your original field and since upgraded to a more current version. I say this as the previous version used the standard Filepath field which then allowed ImageField or FileField to save the data as well, whereas the current version does not. Also, the values stored in the ImageField/FileField widget settings are not used by FileField Paths and are therefore not related to this issue.
There is nothing wrong with ImageField, so I would suggest closing that issue if you have opened one.
I would suggest trying out the patch in #18 as while I haven't been able to reproduce this issue, the solution provided is sound.
Cheers,
Deciphered.
Comment #22
gallamine commented@Deciphered
Thanks for the input. I figured these type of things should have been taken care of by the upgrade path, so that's why I was confused/concerned.
I tried the patch, and it takes care of the preg_match() problem. Thanks!
Comment #23
mihha commentedJust had this issue. Raising the issue from dead, but I want to share how I solved it.
Solution:
1. Disable filefield_paths
2. Remove any settings that you have in file path (you probably have some token there - that is the reason for warning) for your field
3. Enable filefield_paths
4. Check file path for your field (if you didn't uninstall filefield_paths, it should be remembered)
That's it. ;)
It seams that module gets confused if there is a token in file path for filefield (as gallamine already noticed).
Comment #24
roball commentedComment #25
decipheredNo longer supporting Drupal 6 issues for this module.