Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I got error on D7 with error below
Notice: Undefined index: host in _filefield_paths_replace_path() (row 285 von C:\wamp\www\drupal\sites\all\modules\filefield_paths\filefield_paths.module).
Notice: Undefined index: scheme in _filefield_paths_replace_path() (row 287 von C:\wamp\www\drupal\sites\all\modules\filefield_paths\filefield_paths.module).
I use:
- Drupal: 7.12
- Plup: 7.x-1.0-alpha1
- File (Field) Paths: 7.x-1.0-beta3
and the image on the server gets a strange name --> p16nsnqa5e12o0134d1t951mbmmq94.jpg
Comment | File | Size | Author |
---|---|---|---|
#13 | filefield_paths-undefined_index-1474732-13.patch | 1.15 KB | jaydub |
#9 | undefinedindex-1475732-9.patch | 878 bytes | John Bickar |
Comments
Comment #0.0
Bernsch CreditAttribution: Bernsch commentedimage name
Comment #1
sw3b CreditAttribution: sw3b commentedI got the same thing on my side with the same modules ! Except for the name, my file are getting rename correctly. I'm using the token as below.
Comment #2
Bernsch CreditAttribution: Bernsch commentedApparently there is a plup issues
--> link to Plup Issues
Comment #3
Deciphered CreditAttribution: Deciphered commentedGoing to mark this as a duplicate for the moment, unless someone is able to confirm that this issue is reproducable without the Plup module in the mix, or with a fixed version of Plup.
Comment #4
carajito CreditAttribution: carajito commentedNote: The mistake was mine at the token name
Hi, I have the same error and I not use Plup or any other module
Drupal: 7.14
File (Field) Paths: 7.x-1.0-beta3
In the content type is ok but on the taxonomy have the error:
The error be show when I use more than one image
File path = [term:url:unaliased:args:first]/[term:url:path]
File name = [file:ffp-name-only-original].[file:ffp-extension-original]
Thanks for the module
Comment #5
skizzo CreditAttribution: skizzo commentedI am re-opening the issue as I see the error when saving a node with a single imagefield and multiple image instances.
I am not running Plup and for testing purposes I am using the default file name configuration for the image field.
I believe that the error is generated only when "File path" is left blank.
Notice: Undefined index: host in _filefield_paths_replace_path() (line 292 of /var/www/drupal/sites/all/modules/filefield_paths/filefield_paths.module).
Comment #6
BrightBoldI can confirm that like @skizzo in #9, I was getting this error without Plup installed and setting a file path, which had previously been blank, resolved it.
Comment #7
im_lex CreditAttribution: im_lex commentedI also can confirm it. I was getting this error without Plup installed...
Comment #8
HansKuiters CreditAttribution: HansKuiters commentedConfirmed without the Plup module. Setting the filepath in the image field solves this issue, but the final filepath might get a bit messy. It is related to the path the image cache sets, so my final image path becomes http://localhost:8888/sitename.nl/sites/default/files/styles/thumb-news/...
Comment #9
John Bickar CreditAttribution: John Bickar commentedPatchy attachy.
Comment #10
yannickooI'm getting even an error with this patch attached:
As I mentioned in this issue I tried it with file_create_url() and I no more got notices but no I've
public:///
in the uri column.Comment #11
a.mikheychik CreditAttribution: a.mikheychik commentedTo fix this issue, you need to set "File path" option. If it isn't set, the path won't be parsed correctly by parse_url function.
Comment #12
Renee S CreditAttribution: Renee S commentedJohn Bickar, the patch just pushes the problem a few lines down when the module looks for $replacement and can't find it, since the if condition wasn't met...
Comment #13
jaydub CreditAttribution: jaydub commentedIn my testing with a simple core imagefield the issue with the calls to parse_url() in _filefield_paths_replace_path($old, $new, $entity) is that the paths that are passed ($old and $new) to parse_url() are using Drupal's file stream wrappers so in this case $old and $new are using the public:// scheme and so the code that attempts to parse the uri that follows incorrectly parses 'host', 'path', etc.
The attached patch uses file_create_url to convert the stream wrapper uri into something the parse_url() call can use.
Comment #14
torrance123 CreditAttribution: torrance123 commentedThe patch in #13 works correctly.
In my case the value of
$new
in_filefield_paths_replace_path()
ispublic:///test_file.txt
.Once it is passed through
parse_url()
on line 290, the variable$info
is set to empty.Using the patch in #13, the value of
$info
becomes:There are no ill side effects in my testing.
[Edit: corrected the code examples.]
Comment #15
torrance123 CreditAttribution: torrance123 commentedThis bug only appears when there is no path set. With no path the value of
$new
is:public:///test_file.txt
With a path set, in this case 'mycustompath', the value of
$new
is:public://mycustompath/test_file.txt
So it looks like the triple forward slash is confusing
parse_url()
.Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedI couldn't apply the the patch from #13, it is not applicable. The code in 7.x-1.0-beta3 seems different than what the patch expects.
Comment #17
ssllav CreditAttribution: ssllav commentedhi all.
I do not use Plop and have Notice about host too.
But version 7.x-1.x-dev work excellent.
Comment #18
yannickooI can apply the patch against the dev version.
Comment #19
Renee S CreditAttribution: Renee S commentedWorks for me.
Comment #20
toomanypets CreditAttribution: toomanypets commentedThe patch in #13 also resolves the problem I reported in comment 1 on #1830392: Bug triggered by files with space in the filename where the Insert module was inserting the incorrect path when the uploaded file contained spaces in the filename.
Comment #21
Jeffrey C. CreditAttribution: Jeffrey C. commentedIt's been three months and a RTBC patch is available, I suppose we should escalate this issue to critical since this module is currently in an unusable state right now.
Comment #22
Deciphered CreditAttribution: Deciphered commentedReducing this from critical, it's far from critical, a critical issue implies the module breaks stuff, however this is just throwing a warning.
I'm also removing this issue as RTBC, because it's a bandaid patch, it doesn't resolve the real underlying issue. That, and I am unable to reproduce this issue.
If someone can give me a step-by-step guide on how to reproduce this issue I'd be extremely grateful and will get this issue resolved ASAP.
Comment #23
Jeffrey C. CreditAttribution: Jeffrey C. commentedIt only renames the file if you submit the node creation form directly. Doesn't work if you click the upload button when creating a new node.
Comment #24
Deciphered CreditAttribution: Deciphered commented@Jeffrey C.,
File (Field) Paths doesn't do any renaming until the node is save, because how can it replace Node tokens if there is not yet a Node to provide the tokens? That's the whole point of the module. I assume I'm taking your comment out of context however, because it doesn't necessarily seem to be related to my last comment.
Comment #25
Jeffrey C. CreditAttribution: Jeffrey C. commentedHmm... That makes sense. Weird thing though, like a couple weeks ago the file doesn't get renamed without the patch in #13. But just tested it out again and everything seems to work just fine. But any idea how the PHP notice is generated?
Comment #26
Deciphered CreditAttribution: Deciphered commentedAs I said, I can't reproduce the issue, I don't get the message, I've gone through all the comments in the issues searching for information on what may have caused it for others, and attempted everything that's been said, but I am still unable to reproduce.
If you are able to get the message, tell me exactly what you are doing from the point of a fresh install of Drupal and then I might be able to get to the bottom of the issue.
Comment #27
Jeffrey C. CreditAttribution: Jeffrey C. commentedTry http://simplytest.me/project/filefield_paths. Then create an article.
Comment #28
Deciphered CreditAttribution: Deciphered commentedOk, so I did that, and I tested both with 7.x-1.0-beta3 and 7.x-1.x, it was an issue in 7.x-1.0-beta3 but worked fine in 7.x-1.x.
Therefore this issue is fixed and closed.
Comment #29
claudiuv CreditAttribution: claudiuv commentedThis bug is still active with 7.x-1.0-beta3 and the latest drupal core.
Comment #30
Deciphered CreditAttribution: Deciphered commentedCaludiv,
The issue is fixed in 7.x-1.x-dev, it will be part of the next beta release or stable release.
Comment #32
miamitops CreditAttribution: miamitops commentedi just changed the configuration in drupal admin logging and errors not to display those errors
Comment #32.0
miamitops CreditAttribution: miamitops commentedtext correction