Closed (fixed)
Project:
File (Field) Paths
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
6 Jan 2011 at 22:36 UTC
Updated:
8 Sep 2017 at 10:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
vitok-dupe commentedsame problem.
subscribe.
Comment #2
pglatz commentedSame problem - line 599
Comment #3
chriz001 commentedsubscribe
Comment #4
mooselimb commentedSame here. Has there been a fix in the intervening period?
When uploading image (I guess it'll be the same with any file) I get:
Notice: Undefined variable: type in filefield_paths_process_string() (line 598 of site-directory/sites/all/modules/filefield_paths/filefield_paths.module)Disabling Transliteration in the file name & file path settings stops the error.
Admin > Structure > Content types > Image > edit > image settings > Image Path settings > FILE NAME cleanup settings
&
Admin > Structure > Content types > Image > edit > image settings > Image Path settings > FILE PATH cleanup settings
Does this mean it's a Transliteration prob?
I'm using FileField Paths 7.x-1.x-dev & Transliteration 7.x-3.0-alpha1
Comment #5
Barfly commentedhello ,
same problem i got : Notice: Undefined variable: type in filefield_paths_process_string() (line 600 of C:\...\modules\filefield_paths\filefield_paths.module
Comment #6
metakel commentedI have the same error and with the same line number. And I notice that the module does not have effect on transliterating the uploaded file paths of removing spaces.
e.g. I'd set the uploaded file path of an image field to: images/[node:title], with all "Cleanup using Pathauto", "Convert to lower case", "Transliterate File path" selected.
Then when the node title is "Firstname Lastname", the file should be placed at: "images/firstname-lastname". But it turns out to be put at: "images/firstname lastname". Note that the space is not removed.
I wonder whether this is related to the above error of "Undefined variable".
Comment #7
johnvSubscribe, other line number (with latest = FileField Paths 7.x-1.x-dev (2011-Feb-25)):
Notice: Undefined variable: type in filefield_paths_process_string() (line 610 of .../filefield_paths.module).
It seems like a D6->D7 porting error.
This is a porting error: maintainer has removed the $type-argument in function filefield_paths_process_string(), because the calling logic has been changed.
Following the symptom in #6, I suggest removing the line in filefield_paths.module:
if ($type == 'field') {Comment #8
ansorg commentedre #7: removing just this line does not make any sense because this would break the code completely.
One could remove the whole if () {..} block but then this part of the function does nothing and makes no sense anymore.
Like the OP, I don't understand what this $type could be and have no idea how to fix this.
Subscribe
Comment #9
jeffwidman commentedsubscribe
Comment #10
sachbearbeiter commentedNotice: Undefined variable: type in filefield_paths_process_string() (line 598 of /xxx/filefield_paths/filefield_paths.module).
subscribe - same problem ...
Comment #11
tommychrissubscribe
Comment #12
Anonymous (not verified) commentedHere's a patch that seems to fix it (needs testing).
I simply removed the if statement (but not the code in the if statement) after looking at version 6 of this module and working out that it probably just got left over in the upgrade (as johnv suggested in #7 above).
This gets rid of the errors for me, but others should test to make sure it has no adverse effects.
Comment #13
h0tw1r3 commentedProblems with current function:
1. Original reported issue, notice error $type is undefined, stems from 6 -> 7 api changes.
2. Entire path is normalized instead of the individual tokens. Problem arises when the non-token portions in the value set by an admin will be unexpectedly changed by transliterate, pathauto, or lower.
3. Pathauto is not implemented
Patch refactors filefield_paths_process_string, breaking out the individual cleaners (transliterate, pathauto, lower) to a callback function.
Comment #14
metakel commentedsame Notice at line 555.
I'd tried the patch file of #13 but
I'm using 7.x-1.x-dev
Comment #15
h0tw1r3 commentedIf you are in the filefield_paths directory use:
patch -p2 < filefield_paths-cleanup_string.patchComment #16
metakel commentedthank you, I'd used -p0. Now with -p2 I patched successfully.
Comment #17
metakel commentedoh, after patched with #13, I've got this:
filefield_path.module around line 574 is listed below:
Comment #18
h0tw1r3 commentedFixed, and tested with transliteration module.
Comment #19
metakel commentedthank you very much! After patched the #18's file with the 7.x-1.x-dev, the notice becomes:
Comment #20
h0tw1r3 commentedAm I correct in assuming you have files without extensions (no .jpg, .txt, .png, etc)? Extensions are required with the File and Image fields. Not sure how this is happening. Either way, it's a separate issue. If you have more detail (file name, origname, field definition, etc), please open a new issue.
Comment #21
metakel commentedAll my files have either .png or .jpg extensions. Thank you for your advice.
Comment #22
h0tw1r3 commentedFix applied to 7.x-1.x-dev in commit 367ccd0.
Comment #23
metakel commentedI have just replaced the filefield_paths.module by #22's. The below error is still displayed when I tried to save a content.
The content type which I wished to save has the following field type: Dateime, image, term reference, text and node reference. It has "Multilingual support" set to "Enabled, with translation".
In all my content fields (with file storage function), all the below three were selected (boxes checked) in both FILE PATH CLEANUP SETTINGS" and FILE NAME CLEANUP SETTINGS
File path token were all set to event/[node:nid]
File name token were all set to [file:ffp-name-only-original].[file:ffp-extension-original] <= the default one
Comment #24
h0tw1r3 commentedmetakel, please open a new issue and include details for reproducing the problem. I would also suggest upgrading to the latest dev release.
Comment #26
decipheredRe-opening, the patch that was committed for this issue is not correct, it's applies the cleanup only to the tokens, not to anything else.
While I acknowledge that if a user was to use plain text in their replacement pattern and then set cleanup to set it to lower case, they are silly indeed, but I would still expect the plain text elements of the replacement pattern to be processed.
Comment #27
decipheredReverted to patch by BWPanda in latest dev.