I enabled dynamic banner then went to create a new banner. I created the banner uploaded the image and filled in the rest of the details. Clicked to create the banner and got several errors. The first ones were related to the date, applied a patch for it but I still had this error: Notice: Undefined index: #field_name in file_managed_file_save_upload() (line 620 of C:\wamp\www\drupftg\modules\file\file.module).
So tried to create another banner but I get the error as soon as I try to upload an image now instead of upon creation. Not sure what to think about this error. I have seen other undefined index #field_name errors in other modules but it seems like they are handling them on a case by case basis with patches to the individual modules. Searching drupal doesnt seem to return any specific errors the same as this one.
Comments
Comment #1
coolestdude1 CreditAttribution: coolestdude1 commentedYou are correct I reproduced it, working on a fix right now.
Comment #2
coolestdude1 CreditAttribution: coolestdude1 commentedThe quick work around to this is put a file save directory location into your dynamic banner settings. For some reason the default save location is not loading. Which is public://banners which translates into sites/default/files/banners/ if your site is setup in this fashion. I am currently working on a fix for this but this would be how to get past the problem just for now. I'll let you know more as it develops and I will have to work on the bug more.
Comment #3
nzxt CreditAttribution: nzxt commentedThanks for looking into this. I will go ahead and use the work around.
Comment #4
coolestdude1 CreditAttribution: coolestdude1 commentedFixed, pushing release soon thanks for the reminder :)
I recommend you uninstall the module before you download the new release sorry about this but the variables have changed names.
Comment #5
ther CreditAttribution: ther commentedI tried the suggested hotfix, and the new (august 22th dev release), neither of them worked for me.
My solution:
- Go to my_drupal_path/sites/all/modules/dynamic_banner/includes/callbacks.php line 352, it should look like this:
And change it to:
I suppose this causes loss of functionality, but originaly was unable to even upload images. Hope this helpes others in need and maybe the solution of the issue.
Comment #6
coolestdude1 CreditAttribution: coolestdude1 commentedThis is not needed but I have not be able to reproduce the problem after I fixed it. The original problem was that the variable was set to null. If I used the variable get call correctly it means that it will try to load the variable 'dynamic_banner_file_save_path' first if it does not exist it will use the second argument as the default which is the php constant 'BANNER_DEFAULT_SAVE_LOCATION' which is set earlier on in the call stack. So the hard fix is that what you mentioned to set the upload location but I technically cover my own @ss by setting it twice basically. I did some testing and if you set the settings up correctly it should not happen. So can you please tell me all the steps you took to get the bug to appear after a fresh install.
Comment #7
organicHack CreditAttribution: organicHack commentedI'm curious if you posted the patch for this. I just had the same errors show up, and I have the latest version of this module installed. Specifically, here is what I get:
Notice: Trying to get property of non-object in dynamic_banner_admin_form() (line 261 of /home/sites/ssw.columbia.edu/web/sites/all/modules/dynamic_banner/includes/callbacks.inc)
before I even add anything.
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /home/sites/ssw.columbia.edu/web/includes/entity.inc)
Notice: Trying to get property of non-object in dynamic_banner_image_handler() (line 767 of /home/sites/ssw.columbia.edu/web/sites/all/modules/dynamic_banner/includes/callbacks.inc).
Thanks!
Comment #8
DrupalDan CreditAttribution: DrupalDan commentedsubscribe
Comment #9
erasmosis CreditAttribution: erasmosis commentedYup me to. Any fix on this?
Comment #10
rooby CreditAttribution: rooby commentedFor reference, the problem you have is that the files directory that it is trying to save files to is not writable.
Make the files directory writable and the error should go away.
However there is an underlying problem, which is the undefined index error, which seems to be caused by drupal core.
See #1903010: Notice: Undefined index: #field_name in file_managed_file_save_upload()
Comment #11
xiangrikuiyy CreditAttribution: xiangrikuiyy commentedI got the same issue but I solved it with changing the file permission to read & write
Comment #12
scuba_flyConfirming that changing the file permission to read & write fixed it for me.
Comment #13
RAWDESK CreditAttribution: RAWDESK for Colruyt Group Services commentedI had to apply chmod 777 to private file path, configured from within a webform, to fix this issue on local host (using a vagrant box).
Comment #14
coolestdude1 CreditAttribution: coolestdude1 as a volunteer commentedAs rooby has mentioned you'll want to make sure that the directory is writable by your web user. If you continue to have this issue you might want to dig further at how you have your user writing files to the disk. You will want to ensure that your web user is setup to be able to write to those directories and that it has been allowed by any gate controls (SELinux permissions, antivirus etc). If that still does not work you might want to investigate an issue with an improper UMASK for that user which kills off permissions when you apply them with Drupal.
Side note: I will also be further investigating how Dynamic Banner creates this directory in the first place which might reveal the root cause.
Comment #15
Donit CreditAttribution: Donit commentedApplying 775 worked for me.