If I am posting this in the incorrect place, please direct me to the correct issue queue.

In our D6 site, we were using IMCE CCK Image with IMCE browser. I used imceimage_2_filefield to convert to FileField and then upgraded to D7. There were no errors in the image migration and I am able to see images on migrated content - including editing, removing, and adding new images.

When I try to add a new page with nothing in the optional image field, I receive the following errors:

The website encountered an unexpected error. Please try again later. 
Notice: Undefined property: stdClass::$fid in file_usage_add() (line 654 of /var/www/domain/includes/file.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 4075 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 661 of /var/www/domain/includes/file.inc).

When I include the optional image in the page, it saves without a problem. Interesting to mention, even with the error, if I look at new content, the page was created. The file_usage error upon save makes it look like it was not.

This repeats itself creating new content with every content type that contains a migrated image field.

In troubleshooting, I found that if I add the same field to my content type and remove the migrated image field, everything works fine. However doing this, I lose years worth of image file associations.

An example of this is: I have a "Kids" content type. If I remove the existing "field_image" and add the same exact "field_image" back in, adding new content doesn't require data in field_image to save correctly.

Can someone help me troubleshoot the existing content types with migrated image fields?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hwasem’s picture

Title: Unable to add new node with IMCE field after upgrade to D7 for existing Content Types » Unable to add new content with migrated Image field after upgrade to D7
Project: IMCE » Drupal core
Version: 7.x-1.5 » 7.14
Component: Code » image system

Moving to core since I'm not sure if this is core or module specific.

hwasem’s picture

I've been able to determine using Devel Backtrace that the value given for the first/0 arg is actually an incorrect array of imceimage file descriptors. Here is the submission being passed to file_usage_add() before the error is triggered:

14: file_usage_add() (Array, 2 elements)

    file (String, 21 characters ) includes/file.inc:654
    args (Array, 4 elements)
        0 (Object) stdClass
            imceimage_path (String, 0 characters )
            imceimage_width (String, 0 characters )
            imceimage_height (String, 0 characters )
            imceimage_alt (String, 0 characters )
        1 (String, 4 characters ) file | (Callback) file();
        2 (String, 4 characters ) node
        3 (String, 4 characters ) 4092

So now I'm trying to trace back the point where this enters the picture. After running IMCEImage_2_filefield module and then upgrading to Drupal 7, I didn't think these references to IMCE should be used any more.

Looking back further in the backtrace, I see that the first mention of IMCEIMAGE is passed in step 12: image_field_insert:

12: image_field_insert() (Array, 2 elements)

    file (String, 33 characters ) modules/image/image.field.inc:250
    args (Array, 8 elements)
        0 (String, 4 characters ) node
        1 (Object) stdClass
        2 (Array, 17 elements)
        3 (Array, 15 elements)
            weight (String, 2 characters ) -1
            label (String, 11 characters ) Event Image
            widget_type (String, 17 characters ) imagefield_widget
            description (String, 0 characters )
            default_value (Array, 1 element)
                0 (Array, 4 elements)
                    imceimage_path (String, 0 characters )
                    imceimage_width (String, 0 characters )
                    imceimage_height (String, 0 characters )
                    imceimage_alt (String, 0 characters )
            widget (Array, 5 elements)
            display (Array, 7 elements)
            settings (Array, 9 elements)
            required (Integer) 0
            id (String, 3 characters ) 107
            field_id (String, 2 characters ) 32
            field_name (String, 17 characters ) field_image_event
            entity_type (String, 4 characters ) node
            bundle (String, 5 characters ) event
            deleted (String, 1 characters ) 0
        4 (String, 3 characters ) und
        5 (Array, 2 elements)
            ∞ (Recursion)

So now I just need to figure out where the IMCEIMAGE reference is coming from and why the correct FID array is not being used.

aangel’s picture

I'm getting exactly the same error in exactly the same situation. Did you get to the bottom of it?

hwasem’s picture

Unfortunately, no. I still don't have a solution, other than adding in the image and then removing it after the node created. Glad to know it is not just me, though :)

kenorb’s picture

Similar: #905108: Integrity constraint violation: 1048 Column 'fid' cannot be null

My error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 12459 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 661 of /Users/kenorb/Sites/XXX/docroot/includes/file.inc).

But I'm not using image, just a file field.
It happens when submitting the node using ctools wizard multistep.
None of the files were posted.

This could be related as well:
#1163740: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed}

kenorb’s picture

Category: bug » support

Following code (from Drupal core) in my specified case:

function file_usage_add(stdClass $file, $module, $type, $id, $count = 1) {
  if (is_null($file->fid)) {
    var_dump($file, $module, $type, $id, $count); exit;
  } 
  db_merge('file_usage')
    ->key(array(
      'fid' => $file->fid,
...

returns:

object(stdClass)[311] // <!-- 1st argument is EMPTY object
string 'file' (length=4)
string 'node' (length=4)
string '12461' (length=5)
int 1

Backtrace:

'function' => string 'file_usage_add' (length=14)
'function' => string 'file_field_insert' (length=17)
'function' => string '_field_invoke' (length=13)
'function' => string 'field_attach_insert' (length=19) (node)
'function' => string 'node_save' (length=9) (my module)

Problem:
node which is saved contains somehow empty/null value:

public 'field_file' => 
    array
      'und' => 
        array
          0 => null

This is because:
When I'm submitting step which has file field on the page, the following variable is _POSTed to $form_state:

array
  'previous' => string 'Back' (length=4)
  'next' => string 'Continue' (length=8)
  'field_file' => 
    array
      'und' => 
        array
          0 => 
            array
              '_weight' => string '0' (length=1)
              'fid' => int 0
              'display' => string '1' (length=1)
              'description' => string '' (length=0)
              'upload_button' => string 'Upload' (length=6)
              'remove_button' => string 'Remove' (length=6)
              'upload' => string '' (length=0)
  'form_build_id' => string 'form-xxx' (length=48)
  'form_token' => string 'xxx' (length=43)
  'form_id' => string 'xxx' (length=31)
  'op' => string 'Continue' (length=8)

, after that I'm copying values from field_file to my $node object, so at this point everything is perfect.
The problem is when those details are loaded from cache and are damaged by _field_invoke_multiple().

It happens when I'm doing preview of the node by following code (#1622952: The right way to programatically render the preview of node object before the creation):

  $node = ctools_object_cache_get('foo', 'node');
  $node->in_preview = TRUE;
  _field_invoke_multiple('load', 'node', array(NULL => $node)); // THIS function did some changes to $node object !
  field_attach_prepare_view('node', array(NULL => &$node), 'full'); // lets field types and formatters load additional data needed for display
  $build = @node_view($node, 'full');
// in different function I've:
$node = ctools_object_cache_get('foo', 'node');
node_save($node);
// here I've the fatal error, because the data in $node has been overridden by _field_invoke_multiple()

and following line in that function (_field_invoke_multiple):

$entity->{$field_name}[$langcode] = $grouped_items[$field_id][$langcode][$id];

is overriding the field values, changing field_file array to NULL.

XDebug snapshot:

$langcode = 'und' modules/field/field.attach.inc:363
$entity = class stdClass { public $type = 'xxx'; public $workflow = 5; public $status = 1; public $promote = 0; public $sticky = 0; public $uid = '181'; public $created = 1341591323; public $revision = FALSE; public $comment = '0'; public $field_file = array ('und' => array (0 => array ('_weight' => '0', 'fid' => 0, 'display' => '1', 'description' => '', 'upload_button' => 'Upload', 'remove_button' => 'Remove', 'upload' => ''))); public $in_preview = TRUE } modules/field/field.attach.inc:364
$id = '' modules/field/field.attach.inc:364
=> $entity->field_file['und'] = array (0 => NULL) modules/field/field.attach.inc:366

I've fixed my problem by cloning ctools cached the object, See: #1676696: ctools_object_cache_get() returns reference, instead of clone
But still the question is, why _field_invoke_multiple is overriding the node values (some of them to NULL) when doing node preview.

asb’s picture

Category: support » bug

Deescription suggests a bug, changing category.

hwasem’s picture

Version: 7.14 » 7.15

I just upgraded to Drupal 7.15 and the error remains the same.

Have you found any solutions yet, Aangel or Kenorb?

jenlampton’s picture

Version: 7.15 » 7.16

Hi Guys, I'm now working on the same site @aangel found this problem on, and I'd like to get to the bottom of it. To recap, we are working with a D7 site that has been upgraded from D6. Creating a node with a migrated image field on it throws errors when the image field is left empty:

PHP Notice

Notice: Undefined property: stdClass::$fid in includes/file.inc on line 654

PDO Fatal:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 361 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 661 of includes/file.inc).
serhiyvk’s picture

I'm getting the same error. Drupal site was migrated from Drupal 6, and I've used imceimage before. Now it is exactly as in #2. I can not have file field, which was migrated from imceimage field, to be empty, for it gives error message as in Issue Summary

jenlampton’s picture

Version: 7.16 » 7.17
Component: image system » file system

I'm up to 7.17 now, and having this problem on files as well as images. Any file or image field that has been upgraded from D6 to D7 throws PDO errors when left blank. I'm not sure what the difference is between the D6 upgraded fields, and why this isn't an issue for newly-created fields in D7. But what is happening is that a "file" made up of the array below ends up getting passed into file_field_insert().

Array
(
    [embed] => 
    [value] => 
)

In my case, that "file" was passed in from _field_invoke and in the case of #6 it was passed in from _field_invoke_multiple.

jenlampton’s picture

better title :)

It looks like there is already a hook-like function that allows field types to define their primary field, and allow the field to be set as "empty" when that primary field is blank. File module uses it: file_field_is_empty.

Unfortunately, this function is only called from one place (_field_filter_items) and that function is never called in my case, and I expect not for #6 as well.

The reason this function is never called is because _field_filter_items is only called from within the default field functions for the two ops validate and submit, but those functions only get called when the $options array passed into _field_invoke contains 'default' => TRUE.

The default value for 'default' is FALSE. When the default is false, it causes Drupal to search for module-specific op functions like image_field_validate and file_field_validate (which don't exist) instead of using field_default_validate.

Since these functions don't exist, no function is run on this data at all, and the entire contents of the array get sent along to the next step.

Dave Reid’s picture

Title: Unable to add new content with migrated Image field after upgrade to D7 » Unable to add new content with empty upgraded image/file field

I think that #1443158: file_field_presave assumes that a file object has been loaded may resolve this, likely this is a duplicate of that issue.

jenlampton’s picture

No, it's not related.

At the time file_field_presave is run $items is just an empty array for me, so the patch #1443158: file_field_presave assumes that a file object has been loaded makes no difference in this case.

Maybe I can use the same approach for file_field_insert though, since it's not safe to assume that $items are properly formatted before they get here.

This patch seems to do the trick.

Dave Reid’s picture

Status: Active » Needs review

If at the time of presave $items is an empty array, but at insert, it's not, then I'm not sure what core should actually be doing. Something is injecting invalid data inbetween those times. Presave should be the proper place to fix it...

jenlampton’s picture

Well, the only module I am using that implements hook_field_insert is media, and it's implementation is almost exactly the same as file_field_insert. (none implement hook_field_presave).

What comes between presave and insert?

Status: Needs review » Needs work

The last submitted patch, core-save_upgraded_empty_fields-please-1627860-15.patch, failed testing.

kenorb’s picture

Testing #15.

I could easily reproduce it via: drush -y generate-content --types=advert 10
Now instead of:

array_flip(): Can only flip STRING and INTEGER values! entity.inc:178                                                                                                                                                                                              [warning]
array_flip(): Can only flip STRING and INTEGER values! entity.inc:178                                                                                                                                                                                              [warning]
WD node: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2,            [error]
:db_insert_placeholder_3, :db_insert_placeholder_4); Array
(
    [:db_insert_placeholder_0] => 
    [:db_insert_placeholder_1] => file
    [:db_insert_placeholder_2] => node
    [:db_insert_placeholder_3] => 3
    [:db_insert_placeholder_4] => 1
)
 in file_usage_add() (line 661 of /home/ubuntu/docroot/includes/file.inc).

I see:

array_flip(): Can only flip STRING and INTEGER values! entity.inc:178                                                                                                                                                                                              [warning]
array_flip(): Can only flip STRING and INTEGER values! entity.inc:178                                                                                                                                                                                              [warning]
array_flip(): Can only flip STRING and INTEGER values! entity.inc:178                                                                                                                                                                                              [warning]
WD node: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2);     [error]
Array
(
    [:db_insert_placeholder_0] => 0
    [:db_insert_placeholder_1] => 1
    [:db_insert_placeholder_2] => 1355846014
)
 in drupal_write_record() (line 7036 of /home/ubuntu/docroot/includes/common.inc).
kenorb’s picture

lsolesen’s picture

Version: 7.17 » 7.19
Status: Needs work » Needs review

I can confirm that #15 solves the problem for med on a migrated file field from D6 --> D7. That patch seems to fix problems for some people. Shouldn't it just be commited for it self in stead of combining patches which fixes several problems (which some I do not experience?)? No 15 is RTBC for me.

Dave Reid’s picture

I still think that something inserting an invalid value between hook_file_presave() and hook_file_insert() means you have something else wrong that shouldn't be hidden by core.

groovedork’s picture

same problem here

_grizly’s picture

I used #15 with success, however I had to apply the principle to hook_field_update as well

Tested with a few hundred nodes.. failed again .. :-( at least it doesn't fail after 10 nodes.. now I'm getting:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2

Noticed in the logs that it was some object based issue, so I added a wrapper call to "is_object" before trying it, worked on all 10k odd nodes! YAY No more errors!

function addImageToNode(&$node, $imagePATH) {
    $image_data = file_get_contents($imagePATH);
    if (strlen($image_data) > 1) {
        if (REDOEMALL) {
            $image_file = file_save_data($image_data, 'public://', FILE_EXISTS_REPLACE);
        } else {
            $image_file = file_save_data($image_data, 'public://', FILE_EXISTS_ERROR);
        }
//file_save_data returns false on error or ERROR, so this call is skipped and the image isn't attached.
        if (is_object($image_file)) {
            try {
//We just saved a new file, lets attach it correctly to the node.
                $node->field_product_photos[$node->language][0] = (array) $image_file;
                field_attach_validate('node', $node);
            } catch (FieldValidationException $e) {
                if (DEBUG)
                    print $e->getMessage();
                return false;
            }
            return true;
        }
    }

    return false;
}

Needs a bit of work to attach multiple images.. but its getting there. (Note, calls to is_readable etc are in a parent function, this simply attaches the image, maybe I just have to remove the 0.. ;-)

_grizly’s picture

Issue summary: View changes

fixing code formatting

manoloka’s picture

I can confirm that #15 fixed the issue for me

jenlampton’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

There have been several reviews that say #15 solves the problem. Any chance we can get this committed, or maybe get some more feedback that might suggest an alternative approach, or a reason why this bugfix is not acceptable? Would love not to have to apply this patch again to 7.26 :)

groovedork’s picture

I am so looking forward to this being fixed. Now I have to manually remember this issue, find this post, and apply the #15 fix afterwards. Of course this always happens after someone creates a new post and get an error, losing their work :-(

hwasem’s picture

@groovedork, my OP was finally fixed with 7.25 update. I've been following one of the issues linked in #22 about by @kenorb, but it appears that the other issue, #1443158: file_field_presave assumes that a file object has been loaded, was included in 7.25 and fixed it. I just tested in my dev environment and it worked without patching.

I'm going to mark this closed and dup of #1443158.

hwasem’s picture

Title: Unable to add new content with empty upgraded image/file field » [solved]Unable to add new content with empty upgraded image/file field
Status: Reviewed & tested by the community » Closed (duplicate)
kenorb’s picture

andrewfn’s picture

#15 worked for me as well. Thanks jenlampton.
Note: the issue marked as a duplicate did not fix the problem for me.
It patched hook_field_presave() whereas #15 is patching hook_field_insert() with the same kind of fix. It looks as if both patches are needed.
It would be good if this could be committed so we don't have to patch core on every new release.

criscom’s picture

#15 worked for me. Thanks.

groovedork’s picture

I agree with Andrew. This is the only module I use that requires manual fixing. It would be great to commit this patch.

davidhk’s picture

Some more information about this problem, and a suggested solution that removes the need to patch the code.

I have the same problem described in #12:
- a content type that in D6 had an "Embedded Image" field that has been migrated to a D7 file field.
- If that field is left empty and the node is saved, I get the PDOexception shown at the top of the thread.
- The exception happens when a "file" made up of the array below ends up getting passed into file_field_insert().

Array
(
    [embed] =>
    [value] =>
)

The node has another file field ("Upload", the file attachments field) that can be left blank without any problem.

Looking through the backtrace, when I enter node_save(), neither of the file fields are present on the $node. Same when it calls field_attach_insert(), but after that calls _field_invoke_default(), the bad field is added to the node, with contents:

Array
(
    [embed] =>
    [value] =>
)

The problem happens in field_get_default_value(), which has the lines:

  elseif (!empty($instance['default_value'])) {
    $items = $instance['default_value'];
  }

That 'default_value' is stored in the table field_config_instance, in the data column.

If I look at bad file field's entry, the data column includes:

    [default_value] => Array
        (
            [0] => Array
                (
                    [embed] => 
                    [value] => 
                )

If I look at the good file field's entry, there is no '[default_value]'.

I think it's a bit of rubbish left over from the D6->D7 migration, so I've used the following code to delete the '[default_value]' section from that field:

  $field_name='YOUR_FIELD';
  $bundle='YOUR_BUNDLE';
  $data = db_query('SELECT data FROM {field_config_instance} WHERE field_name = :field_name AND bundle = :bundle', array(':field_name' => $field_name, ':bundle' => $bundle))->fetchField();
  $data = unserialize($data);

  unset($data['default_value']);

  db_update('field_config_instance')
    ->fields(array('data' => serialize($data)))
    ->condition('field_name', $field_name)
    ->condition('bundle', $bundle)
    ->execute();

After that I can save a node with the field left empty, and there isn't any exception.

amcc’s picture

Thanks davidhk - the previous comment is much more useful than the patch

I upgraded my website after previously patching like this - then the patch disappeared and hence the problem reappeared. As far as i know this still isnt in core so you really need to fix the root of the problem not patch

I made a new page with input type "php" to enable me to do this in a simple way - you then just save the node and the page should load, but depending on where you're editing it from you may have to then visit the page.

In case you were confused as to what the YOUR_FIELD and YOUR_BUNDLE needed to be - visit your node type and find the field names for any image / media type fields, the field is the machine name for the field, the bundle is the machine name for the content type. Go to the field_config_instance table in your database and you can check there too.

i also flushed the cache which i think might sometimes be necessary, here's some php which helps print out the $data so you can check all is well - this is what is in my node - completely copied from the great post by davidhk, with a bit of output:

// from this article
// https://www.drupal.org/node/1627860#comment-9238389

$field_name='YOUR_FIELD';
  $bundle='YOUR_BUNDLE';
  $data = db_query('SELECT data FROM {field_config_instance} WHERE field_name = :field_name AND bundle = :bundle', array(':field_name' => $field_name, ':bundle' => $bundle))->fetchField();
  $data = unserialize($data);
  unset($data['default_value']);


  db_update('field_config_instance')
    ->fields(array('data' => serialize($data)))
    ->condition('field_name', $field_name)
    ->condition('bundle', $bundle)
    ->execute();
print('<pre>');
print_r($data);
print('</pre>');
print('done it');
kcolwell’s picture

Thanks davidhk and amcc... your posts saved me a lot of time today.

For anyone who is just hitting this problem you can also save the above code as a php file (field_fix.php) and run it from drush with the following command:

drush php-script field_fix.php

Then follow with a cache clear:
drush cc all

I highly recommend doing this on a test version of your site first just to make sure that you don't break something else.

Ken Colwell

David_Rothstein’s picture

Title: [solved]Unable to add new content with empty upgraded image/file field » file_field_insert assumes that a file object has been loaded
Version: 7.19 » 7.x-dev
Status: Closed (duplicate) » Needs review

Let's reopen this given that the other issue is fixed but didn't seem to fully solve the issue for everyone.

However I agree with the questions above by Dave Reid and others - why would we need to do this in file_field_insert() if we're already doing it in file_field_presave()? It doesn't seem like that's been answered... if some other module is inserting bad data into the entity after presave has already run, isn't that a bug in that module instead?

David_Rothstein’s picture

Based on #36, if that's the source of the problem for everyone (not sure if it is), that would suggest this needs to be fixed via an update function rather than via runtime code?

David_Rothstein’s picture

Title: file_field_insert assumes that a file object has been loaded » Unable to add new content with empty upgraded image/file field

Given that, I'm restoring the earlier title for now.

jenlampton’s picture

Well, I've written an update hook as per #36 but now I'm not sure this belongs as part of core either. Where is the right place for this hook, as part of CCK migrate, perhaps?

Here's the update (currently written as part of file module) in case anyone else needs it before we decide where to put it.

/**
 * Cleanup left over data from D6 upgrade.
 */
function file_update_7001(){
  $fields = field_info_fields();
  foreach ($fields as $field_info) {
    if ($field_info['type'] == 'image' || $field_info['type'] == 'file') {
      foreach ($field_info['bundles'] as $entity_type) {
        foreach ($entity_type as $bundle) {
          $data = db_query('SELECT data
                            FROM {field_config_instance}
                            WHERE field_name = :field_name
                            AND bundle = :bundle',
                          array(
                            ':field_name' => $field_info['field_name'],
                            ':bundle' => $bundle))
                    ->fetchField();

          $data = unserialize($data);
          if (isset($data['default_value'])) {
            unset($data['default_value']);
            $data = serialize($data);

            db_update('field_config_instance')
              ->fields(array('data' => $data))
              ->condition('field_name', $field_info['field_name'])
              ->condition('bundle', $bundle)
              ->execute();
          }
        }
      }
    }
  }
}
jackalope’s picture

Thanks for the update hook in #36, @jenlampton! This error suddenly cropped up on a D7 site I recently inherited that had been upgraded from D6; adding the hook to modules/file/file.install and running the resultant database update fixed the problem.

I'll note that the error occurred whenever a node was created that included an upgraded image (file) field, whether or not the field was empty. The error did not occur when editing an existing node, only when first saving a new node.

TheodorosPloumis’s picture

I can confirm that patch from #15 fixes the issue for me. Thanks a lot!

serhiyvk’s picture

I did #38, but the code from #37 I had to wrap in <?php ... ?>, only then it worked for me and solved the problem. Thanks, @davidhk, @amcc and @kcolwell.