Skip to content

Problem uploading gif, undefined properties $m_nDelay, $m_bTrans, $m_nTrans #40

@justb3a

Description

@justb3a

Short description of the issue

I'm not able to upload certain gif files(*). Default images field, valid file extensions: gif jpg jpeg png.

(*) This behaviour doesn't occur for every gif file.

Expected behavior

The gif gets successfully uploaded ;)

Actual behavior

JavaScript enabled:

The gif won't be uploaded (the loading icon never stops spinning).
The following error message occurs:

VM1720:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Function.parseJSON (JqueryCore.js?v=1475855324:2)
    at XMLHttpRequest.<anonymous> (InputfieldImage.js?v=119-1475855324:1403)

InputfieldImage.js: var response = $.parseJSON(xhr.responseText),

JavaScript disabled

The gif gets uploaded but the following PHP Notices occurs:

Notice: Undefined property: ProcessWire\PWGIFIMAGE::$m_nDelay in /../public/wire/core/ImageInspector.php on line 231

Notice: Undefined property: ProcessWire\PWGIFIMAGE::$m_bTrans in /../public/wire/core/ImageInspector.php on line 232

Notice: Undefined property: ProcessWire\PWGIFIMAGE::$m_nTrans in /../public/wire/core/ImageInspector.php on line 233

Screenshots/Links that demonstrate the issue

This is the gif file I'm trying to upload.

Suggestion for a possible fix

@ ImageInspector.php:231 @ class ImageInspector extends WireData {
-    $i['delay']     = $gi->m_nDelay;
-    $i['trans']     = $gi->m_bTrans;
-    $i['transcolor']  = $gi->m_nTrans;
+    $i['delay']     = isset($gi->m_nDelay) ? $gi->m_nDelay : '';
+    $i['trans']     = isset($gi->m_bTrans) ? $gi->m_bTrans : '';
+    $i['transcolor']  = isset($gi->m_nTrans) ? $gi->m_nTrans : '';

Steps to reproduce the issue

  1. Try to upload the gif file linked above.

Setup/Environment

  • ProcessWire version: 3.0.36
  • PHP version: PHP 7.0.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions