Woocommerce-admin: [4.3 RC2]: PHP Fatal error: Uncaught WC_Data_Exception: The admin note icon prop cannot be empty.

Created on 2 Jul 2020  路  4Comments  路  Source: woocommerce/woocommerce-admin

Describe the bug
Creating a custom note or even existing WC notes in WC 4.3 RC2 then downgrading from WC 4.3 RC2 to WC 4.2.2 will generate an error:
PHP Fatal error: Uncaught WC_Data_Exception: The admin note icon prop cannot be empty.

Based on my investigation in WC 4.2 table _wc_admin_notes_ it has _icon_ column while in WC 4.3 it was removed and also making set_icon deprecated.

To Reproduce
Steps to reproduce the behavior:

  1. Using WooCommerce Beta Tester plugin, switch to WC 4.3.0-rc.2
  2. Generate a custom Admin Note or just check if it has at least 1 WC Note
  3. Downgrade from WC 4.3 RC2 to WC 4.2.2
  4. It will print:
    PHP Fatal error: Uncaught WC_Data_Exception: The admin note icon prop cannot be empty.

Expected behavior
It should not print a fatal error

Screenshots
image

Wordpress Version 5.4.2
WooCommerce 4.3 RC2

Most helpful comment

I'd just like to add: now that wc admin is bundled with WC core, we should be careful about not making backwards incompatible changes even in wc admin, so theoretically speaking things like removing methods, changing their signatures (except for adding optional parameters) and removing db columns should not happen.

All 4 comments

cc @timmyc this should probably get a fix before the final release.

@timmyc @peterfabian How do we normally handle downgrades when there are DB schema changes?

Really great question Matt. I'm thinking the best protection here is to ensure we are deleting all notes in the db on plugin deactivate. That would at least have notes be generated against the current schema.

With regards to this specific scenario, of changing versions with the beta tester plugin, not sure if that would fix the issue. I'd have to look at the beta tester code to see how it performs the updates and downgrades.

I'd just like to add: now that wc admin is bundled with WC core, we should be careful about not making backwards incompatible changes even in wc admin, so theoretically speaking things like removing methods, changing their signatures (except for adding optional parameters) and removing db columns should not happen.

Was this page helpful?
0 / 5 - 0 ratings