Skip to content

Commit 39daffa

Browse files
authored
Merge pull request #563 from humanmade/backport-562-to-v15-branch
[Backport v15-branch] Ensure Spyc is available
2 parents 314a251 + 4ae55f4 commit 39daffa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

inc/namespace.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ function parse_file( string $file, string $root ) : Page {
358358
$meta = [];
359359
preg_match( '#^---(.+)---\n+#Us', $raw, $yaml_matches );
360360
if ( $yaml_matches ) {
361+
// This library seems to have problems with its autoload configuration
362+
// sometimes so we need to ensure it's available.
363+
if ( ! class_exists( 'Spyc' ) ) {
364+
require_once Altis\ROOT_DIR . '/vendor/mustangostang/spyc/Spyc.php';
365+
}
361366
$meta = Spyc::YAMLLoadString( $yaml_matches[1] );
362367
// Strip YAML doc from the header.
363368
$raw = substr( $raw, strlen( $yaml_matches[0] ) );

0 commit comments

Comments
 (0)