From 6ba5945d2edea2588c246df413276a02ef7c8911 Mon Sep 17 00:00:00 2001 From: Robert O'Rourke <23417+roborourke@users.noreply.github.com> Date: Thu, 7 Mar 2024 16:43:48 +0000 Subject: [PATCH] Ensure Spyc is available --- inc/namespace.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inc/namespace.php b/inc/namespace.php index 9154a931..a5bf5b36 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -358,6 +358,11 @@ function parse_file( string $file, string $root ) : Page { $meta = []; preg_match( '#^---(.+)---\n+#Us', $raw, $yaml_matches ); if ( $yaml_matches ) { + // This library seems to have problems with its autoload configuration + // sometimes so we need to ensure it's available. + if ( ! class_exists( 'Spyc' ) ) { + require_once Altis\ROOT_DIR . '/vendor/mustangostang/spyc/Spyc.php'; + } $meta = Spyc::YAMLLoadString( $yaml_matches[1] ); // Strip YAML doc from the header. $raw = substr( $raw, strlen( $yaml_matches[0] ) );