Bug #22874 Bug Fixed

Error for File Fieldtype

Version: 3.4.4 Reporter: ImmergeTech

I receive the following error on pages that have a conditional looking for a file fieldtype. If the file fieldtype is not there it diplays the following error when logged in as a super admin:

Notice Undefined index: file_id ee/EllisLab/Addons/file/ft.file.php, line 419 show details Severity: E_NOTICE Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:115) ee/EllisLab/ExpressionEngine/Boot/boot.common.php, line 533 show details Severity: E_WARNING

  • Thanks ImmergeTech, and sorry for the trouble. Can you show me a bit of isolated template code that exhibits this problem? I’m having trouble reproducing. Also, what do you mean by “if the file fieldtype is not there”? Do you mean if there is no file populated in the field or if the field doesn’t exist at all?

    Kevin Cupp
    09th January, 2017 at 4:10pm
  • http://www.dev-harrisonburgelectric.com.php56-23.dfw3-2.websitetestlink.com/about/community_involvement/ demonstrates the error. On this page the file field is not pupulated. There is a conditional to check for a value in this field. If there is nothing in this field it will display this error. Here is a sample of the code: {if banner}
    <div class=”parallax” url(‘{banner}’);” data-velocity=”-.1”></div> <div class=”container”> <h1>{title}</h1> </div> </div> {if:else} <div class=”parallax” url(‘https://as1.ftcdn.net/jpg/00/36/72/50/500_F_36725058_DzL1wIFAlgXKXfU2KJ4oAMSTsczk8yeC.jpg’);” data-velocity=”-.1”></div> <div class=”container”> <h1>{title}</h1> </div> {/if}

    ImmergeTech
    10th January, 2017 at 8:05am
  • Hmm ok, I’m still unable to reproduce, you must have some malformed data for that field or something that’s still allowing it to execute that code path. But I’ve posted a solution on the Solution tab above if you need something to get you going again, let us know if it still gives you problems.. We should have that same fix in the next release.

    Kevin Cupp
    10th January, 2017 at 11:09am

You must be signed in to comment on a bug report.

  • Open system/ee/EllisLab/Addons/file/ft.file.php and find this code on line 419:

    $file_info['id_path'] = array('/'.$file_info['file_id'], array('path_variable' => TRUE));

    And REPLACE it with:

    if (isset($file_info['file_id']))
    {
        $file_info['id_path'] = array('/'.$file_info['file_id'], array('path_variable' => TRUE));
    }

ExpressionEngine News

#eecms, #events, #releases