WordPress / wordpress-playground

Run WordPress in the browser via WebAssembly PHP
https://w.org/playground/
GNU General Public License v2.0
1.61k stars 240 forks source link

Browser storage: Unhelpful crash message when outdated code is stored #1121

Open adamziel opened 5 months ago

adamziel commented 5 months ago

When the browser storage is selected and the stored code is outdated and no longer compatible with the current version of Playground, we should:

At the moment, you may see something like this and scratch your head thinking "Playground is broken":

Warning: require(/wordpress/wp-content/mu-plugins/playground-includes/wp_http_fetch.php): Failed to open stream: No such file or directory in /wordpress/wp-content/mu-plugins/0-playground.php on line 114

Fatal error: Uncaught Error: Failed opening required '/wordpress/wp-content/mu-plugins/playground-includes/wp_http_fetch.php' (include_path='.:') in /wordpress/wp-content/mu-plugins/0-playground.php:114 Stack trace: #0 /wordpress/wp-settings.php(2): include_once() #1 /wordpress/wp-config.php(101): require_once('/wordpress/wp-s...') #2 /wordpress/wp-load.php(2): require_once('/wordpress/wp-c...') #3 /wordpress/wp-blog-header.php(2): require_once('/wordpress/wp-l...') #4 /wordpress/index.php(2): require('/wordpress/wp-b...') #5 {main} thrown in /wordpress/wp-content/mu-plugins/0-playground.php on line 114
adamziel commented 5 months ago

Idea from @brandonpayton: Run an integrity check in the browser mode to confirm we're on the latest version before running the code. This sounds related to #566

adamziel commented 4 months ago

Boot protocol will solve this. It will prevent Playground from creating new files within the WordPress directory structure. Instead, it will load them from scratch on each boot which means they'll never get stale.