@@ -320,7 +320,7 @@ public function search($pattern, $path)
320320 if (!$ this ->stateful ) {
321321 clearstatcache ();
322322 }
323- $ globPattern = rtrim ($ path , '/ ' ) . '/ ' . ltrim ($ pattern , '/ ' );
323+ $ globPattern = rtrim (( string ) $ path , '/ ' ) . '/ ' . ltrim (( string ) $ pattern , '/ ' );
324324 $ result = Glob::glob ($ globPattern , Glob::GLOB_BRACE );
325325 return is_array ($ result ) ? $ result : [];
326326 }
@@ -819,6 +819,7 @@ public function fileClose($resource)
819819 */
820820 public function fileWrite ($ resource , $ data )
821821 {
822+ $ data = $ data !== null ? $ data : '' ;
822823 $ lenData = strlen ($ data );
823824 for ($ result = 0 ; $ result < $ lenData ; $ result += $ fwrite ) {
824825 $ fwrite = @fwrite ($ resource , substr ($ data , $ result ));
@@ -969,7 +970,7 @@ public function getAbsolutePath($basePath, $path, $scheme = null)
969970 // basepath. so if the basepath starts at position 0 in the path, we
970971 // must not concatinate them again because path is already absolute.
971972 $ path = $ path !== null ? $ path : '' ;
972- if ('' !== $ basePath && strpos ($ path , $ basePath ) === 0 ) {
973+ if ('' !== $ basePath && strpos ($ path , ( string ) $ basePath ) === 0 ) {
973974 return $ this ->getScheme ($ scheme ) . $ path ;
974975 }
975976
@@ -986,7 +987,7 @@ public function getAbsolutePath($basePath, $path, $scheme = null)
986987 public function getRelativePath ($ basePath , $ path = null )
987988 {
988989 $ path = $ path !== null ? $ this ->fixSeparator ($ path ) : '' ;
989- if (strpos ($ path , $ basePath ) === 0 || $ basePath == $ path . '/ ' ) {
990+ if ($ basePath === null || strpos ($ path , $ basePath ) === 0 || $ basePath == $ path . '/ ' ) {
990991 $ result = substr ($ path , strlen ($ basePath ));
991992 } else {
992993 $ result = $ path ;
0 commit comments