From 4511b021c70892f5d35fa391007c379a0b17c13a Mon Sep 17 00:00:00 2001 From: Steven Slack Date: Tue, 12 Dec 2023 14:39:00 -0500 Subject: [PATCH 1/3] fix validate_path function where validate_file checks for 0 or 2 --- src/assets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets.php b/src/assets.php index 81fab4ce..89ea0be6 100644 --- a/src/assets.php +++ b/src/assets.php @@ -16,7 +16,7 @@ * @return bool True if the path is valid and the file exists. */ function validate_path( string $path ): bool { - return 0 === validate_file( $path ) && file_exists( $path ); + return ( 0 === validate_file( $path ) || 2 === validate_file( $path ) ) && file_exists( $path ); } /** From 8e5d23005ee3b16828dc634b39f345b5d7024ee5 Mon Sep 17 00:00:00 2001 From: Steven Slack Date: Tue, 12 Dec 2023 14:40:42 -0500 Subject: [PATCH 2/3] fix validate_file on Windows for load_scripts function --- src/assets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets.php b/src/assets.php index 89ea0be6..f544dbcb 100644 --- a/src/assets.php +++ b/src/assets.php @@ -119,7 +119,7 @@ function load_scripts(): void { if ( ! empty( $files ) ) { foreach ( $files as $path ) { - if ( 0 === validate_file( $path ) && file_exists( $path ) ) { + if ( validate_path( $path ) ) { require_once $path; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.IncludingFile, WordPressVIPMinimum.Files.IncludingFile.UsingVariable } } From 83943679891dddda81ce89c46de85f4c454cbd19 Mon Sep 17 00:00:00 2001 From: Steven Slack Date: Tue, 12 Dec 2023 14:44:03 -0500 Subject: [PATCH 3/3] fix the validate_file error in the register_post_meta_from_defs function --- src/meta.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/meta.php b/src/meta.php index eb05e2c3..a49d51a9 100644 --- a/src/meta.php +++ b/src/meta.php @@ -135,9 +135,7 @@ function register_meta_helper( function register_post_meta_from_defs(): void { // Ensure the config file exists. $filepath = dirname( __DIR__ ) . '/config/post-meta.json'; - if ( ! file_exists( $filepath ) - || 0 !== validate_file( $filepath ) - ) { + if ( ! validate_path( $filepath ) ) { return; }