Image type atom without thumbnail causes errors

Created on 26 September 2017, about 7 years ago
Updated 12 January 2024, 10 months ago

Hi!

I don't know this is an error or something else...
Image type scald atom created with an empty scald_thumbnail value causes errors:

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/r2ydw/www/includes/entity.inc).
Notice: Trying to get property of non-object in scald_image_scald_fetch() (line 205 of /home/r2ydw/www/sites/default/modules/scald/modules/providers/scald_image/scald_image.module).
Notice: Trying to get property of non-object in scald_image_scald_fetch() (line 206 of /home/r2ydw/www/sites/default/modules/scald/modules/providers/scald_image/scald_image.module).

the main problem is the file_load() call if base_id is NULL: $file = file_load($atom->base_id);

Steps to reproduce:
1. create test site on simplytes.me
2. enable scald core and scald_image modules
3. create a new image type scald atom, but leave Image field ( machine name: scald_thumbnail ) empty ( this field is not required )
4. view the atom: warning and notices will be visible

this can cause db_log warnings on /admin/content/atoms page sometimes

πŸ› Bug report
Status

Active

Version

1.9

Component

Provider: image

Created by

πŸ‡­πŸ‡ΊHungary fox mulder

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States hargobind Austin, Texas

    I just ran into this as well.

    With no image file, a PHP error was being thrown during the AJAX request for
    https://www.example.com/scald/library_dnd

    Warning: array_flip(): Can only flip string and integer values, entry skipped in array_flip() (line 175 of /includes/entity.inc).

    Or, if you have the Entity cache module enabled, this error will appear instead:
    Warning: array_flip(): Can only flip string and integer values, entry skipped in array_flip() (line 84 of /sites/all/modules/entitycache/includes/entitycache.entitycachecontrollerhelper.inc).

    And another error in the scald_image provider module:
    Warning: Attempt to read property "uri" on bool in scald_image_scald_fetch() (line 205 of /sites/all/modules/scald/modules/providers/scald_image/scald_image.module).

    Those errors were causing the Scald sidebar DND panel to not load on my site.

    Requiring the scald_thumbnail field seems like the recommended approach in my tests.

Production build 0.71.5 2024