aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/autoload/autoload_generator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/autoload/autoload_generator.rs')
-rw-r--r--crates/shirabe/src/autoload/autoload_generator.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/shirabe/src/autoload/autoload_generator.rs b/crates/shirabe/src/autoload/autoload_generator.rs
index 55124467..3abf3453 100644
--- a/crates/shirabe/src/autoload/autoload_generator.rs
+++ b/crates/shirabe/src/autoload/autoload_generator.rs
@@ -556,8 +556,11 @@ return array(
// carry over existing autoload.php's suffix if possible and none is configured
if suffix.is_none() && Filesystem::is_readable(&format!("{}/autoload.php", vendor_path))
{
- let content =
- file_get_contents(format!("{}/autoload.php", vendor_path)).unwrap_or_default();
+ // TODO(bytes): preg_match matches over a &str.
+ let content = String::from_utf8_lossy(
+ &file_get_contents(format!("{}/autoload.php", vendor_path)).unwrap_or_default(),
+ )
+ .into_owned();
if let Some(matches) =
preg_match(php_regex!("{ComposerAutoloaderInit([^:\\s]+)::}"), &content)
{