@@ -16,7 +16,9 @@ class Standards
1616
1717
1818 /**
19- * Get a list paths where standards are installed.
19+ * Get a list of paths where standards are installed.
20+ *
21+ * Unresolvable relative paths will be excluded from the results.
2022 *
2123 * @return array
2224 */
@@ -34,6 +36,9 @@ public static function getInstalledStandardPaths()
3436 foreach ($ installedPaths as $ installedPath ) {
3537 if (substr ($ installedPath , 0 , 1 ) === '. ' ) {
3638 $ installedPath = Common::realPath (__DIR__ .$ ds .'.. ' .$ ds .'.. ' .$ ds .$ installedPath );
39+ if ($ installedPath === false ) {
40+ continue ;
41+ }
3742 }
3843
3944 $ resolvedInstalledPaths [] = $ installedPath ;
@@ -229,6 +234,9 @@ public static function isInstalledStandard($standard)
229234 // This could be a custom standard, installed outside our
230235 // standards directory.
231236 $ standard = Common::realPath ($ standard );
237+ if ($ standard === false ) {
238+ return false ;
239+ }
232240
233241 // Might be an actual ruleset file itUtil.
234242 // If it has an XML extension, let's at least try it.
@@ -282,7 +290,7 @@ public static function getInstalledStandardPath($standard)
282290
283291 $ path = Common::realpath ($ standardPath .DIRECTORY_SEPARATOR .'ruleset.xml ' );
284292
285- if (is_file ($ path ) === true ) {
293+ if ($ path !== false && is_file ($ path ) === true ) {
286294 return $ path ;
287295 } else if (Common::isPharFile ($ standardPath ) === true ) {
288296 $ path = Common::realpath ($ standardPath );
0 commit comments