From f96d9ade2d7816a803093b3403bd7001353bf2da Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 7 Oct 2022 01:56:31 +0000 Subject: [PATCH] Build/Test Tools: Use `require_once` instead of `require`. The `sync-stable-blocks.js` file is used to compile the contents of `require-dynamic-blocks.php`, which includes the PHP files required for dynamic Core blocks. Since these files define PHP functions, `require_once` should be used instead of `require` to guard against fatal errors. Follow up to [53688]. Props aristath, SergeyBiryukov, desrosj. Fixes #56738. See #56179. git-svn-id: https://develop.svn.wordpress.org/trunk@54406 602fd350-edb4-49c9-b593-d223f7449a82 --- tools/release/sync-stable-blocks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/release/sync-stable-blocks.js b/tools/release/sync-stable-blocks.js index 64ed6da01c..3f2a1727d7 100644 --- a/tools/release/sync-stable-blocks.js +++ b/tools/release/sync-stable-blocks.js @@ -49,8 +49,8 @@ ${ staticBlockFolderNames } .filter( isDynamic ) .map( toDirectoryName ) .sort() - // To PHP require statement: - .map( dirname => `require ABSPATH . WPINC . '/blocks/${ dirname }.php';` ) + // To PHP require_once statement: + .map( dirname => `require_once ABSPATH . WPINC . '/blocks/${ dirname }.php';` ) .join( "\n" ); fs.writeFileSync(