• Hello,

    I’ve been using that plugin for à while and I must say it is really useful an reliable.

    I discovered a strange behavior while trying to import fields whose value is 0 (having “leave OLD value for this metadata” enabled). It turns out that the fields equals to 0 are not updated.

    I digged a little and found it’s because importer.php uses empty PHP function to decide whether the field must be updated or not (line 312 in v.1.9.9.6). The PHP documentation states that a 0 is considered as empty. I’ve modified the test using equals empty string instead of empty function (because fgetcsv returns an empty string for empty fields).

    I don’t know, if it is a bug or a wanted feature.
    Could you tell me if the change done could lead to others unexpected behaviors or if it is acceptable to patch the code like this (and in that case it could be fixed in a next version?)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Javier Carazo

    (@carazo)

    Good afternoon @lafare,

    And thanks for your message. Really this is not a wanted feature, I have to fix it.

    As you say 0 is different to empty so yes, it has to be changed. I will do it in next version.

    Thanks!

    Plugin Author Javier Carazo

    (@carazo)

    I have just uploaded the new version with bug solved. I have used “===” with a empty string to force correct empty value check.

    Thanks for reporting this bug :).

    If you have one minute, please tell everybody how fast we are solving bug in a review.

    Thread Starter Lafare

    (@lafare)

    did it!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Importing values equal to 0’ is closed to new replies.