From c0ee9f5962edd5f720a080b7852f1d5e236d75f1 Mon Sep 17 00:00:00 2001 From: Richard Danklof Date: Fri, 12 Jun 2026 15:27:30 +0200 Subject: [PATCH] Fix Windows path separator bug in registerNativeComponents() On Windows, SplFileInfo::getPathname() returns backslashes, causing str_replace() with a forward-slash base path to never match. Normalize both paths to forward slashes before comparing so component registration works on all platforms. --- src/NativeServiceProvider.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NativeServiceProvider.php b/src/NativeServiceProvider.php index 0f88a68..19deb2a 100644 --- a/src/NativeServiceProvider.php +++ b/src/NativeServiceProvider.php @@ -386,8 +386,9 @@ protected function registerNativeComponents(): void continue; } - // Get relative path from Components directory - $relativePath = str_replace($componentPath.'/', '', $file->getPathname()); + // Get relative path from Components directory (normalize separators for Windows compatibility) + $normalizedBase = str_replace('\\', '/', $componentPath).'/'; + $relativePath = substr(str_replace('\\', '/', $file->getPathname()), strlen($normalizedBase)); // Remove .php extension $classPath = substr($relativePath, 0, -4);