Automattic / wc-calypso-bridge

20 stars 4 forks source link

Fix WC_Tracks called too early crashing frontpage #1483

Closed ilyasfoo closed 3 months ago

ilyasfoo commented 3 months ago

Changes proposed in this Pull Request:

When using WooCommerce 9.0.0 and viewing homepage as an admin, PHP crashes.

p1717075183129709/1717053288.243629-slack-C011ENB20Q1

How to test the changes in this Pull Request:

  1. Set up with Entrepreneuer plan (by following this guide pdDOJh-3ob-p2, or the old free trial guide and upgrade it to Entrepreneur plan peapX7-1D4-p2)
  2. Go to cli
  3. Run wp wpcomsh plugin use-unmanaged woocommerce
  4. Download and install WooCommerce 9.0.0 beta 2
  5. In your logged in browser, go to homepage in the frontend (not wp-admin)
  6. Observe the homepage is loaded correctly (no white screen)

Other information:

FOR PR REVIEWER ONLY:

github-actions[bot] commented 3 months ago

Size Change: 0 B

Total Size: 200 kB

ℹ️ View Unchanged | Filename | Size | | :--- | :---: | | `./build/53.js` | 1.08 kB | | `./build/index.css` | 883 B | | `./build/index.js` | 126 kB | | `./build/marketing.js` | 58 kB | | `./build/payment-gateway-suggestions.css` | 1.25 kB | | `./build/payment-gateway-suggestions.js` | 6.56 kB | | `./build/plugins.js` | 3.92 kB | | `./build/style-index.css` | 2.15 kB | | `./build/style-marketing.css` | 805 B |

compressed-size-action

ilyasfoo commented 3 months ago

I'm a bit hesitant to try it because we're attempting to include files from a different plugin directly, but we can include the track file if it does not exist. What do you think?

Something like this should work (not tested)

Thanks for the suggestion, @moon0326! I think it's kind of overkill at this point, since we don't intend to actually include tracks that early in execution. The root cause of the bug in WooCommerce 9.0 beta was addressed here, I intend this fix to only ensure that future potential bugs will not cause a crash.