@@ -101,14 +101,32 @@ protected function fetch($ETag, $content, $allowUnstable = false) {
101101 // Exclude all versions not compatible with the current version
102102 try {
103103 $ versionParser = new VersionParser ();
104- $ version = $ versionParser ->getVersion ($ release ['rawPlatformVersionSpec ' ]);
104+ $ serverVersion = $ versionParser ->getVersion ($ release ['rawPlatformVersionSpec ' ]);
105105 $ ncVersion = $ this ->getVersion ();
106- $ min = $ version ->getMinimumVersion ();
107- $ max = $ version ->getMaximumVersion ();
108- $ minFulfilled = $ this ->compareVersion ->isCompatible ($ ncVersion , $ min , '>= ' );
109- $ maxFulfilled = $ max !== '' &&
110- $ this ->compareVersion ->isCompatible ($ ncVersion , $ max , '<= ' );
111- if ($ minFulfilled && ($ this ->ignoreMaxVersion || $ maxFulfilled )) {
106+ $ minServerVersion = $ serverVersion ->getMinimumVersion ();
107+ $ maxServerVersion = $ serverVersion ->getMaximumVersion ();
108+ $ minFulfilled = $ this ->compareVersion ->isCompatible ($ ncVersion , $ minServerVersion , '>= ' );
109+ $ maxFulfilled = $ maxServerVersion !== '' &&
110+ $ this ->compareVersion ->isCompatible ($ ncVersion , $ maxServerVersion , '<= ' );
111+ $ isPhpCompatible = true ;
112+ if (($ release ['rawPhpVersionSpec ' ] ?? '* ' ) !== '* ' ) {
113+ $ phpVersion = $ versionParser ->getVersion ($ release ['rawPhpVersionSpec ' ]);
114+ $ minPhpVersion = $ phpVersion ->getMinimumVersion ();
115+ $ maxPhpVersion = $ phpVersion ->getMaximumVersion ();
116+ $ minPhpFulfilled = $ minPhpVersion === '' || $ this ->compareVersion ->isCompatible (
117+ PHP_VERSION ,
118+ $ minPhpVersion ,
119+ '>= '
120+ );
121+ $ maxPhpFulfilled = $ maxPhpVersion === '' || $ this ->compareVersion ->isCompatible (
122+ PHP_VERSION ,
123+ $ maxPhpVersion ,
124+ '<= '
125+ );
126+
127+ $ isPhpCompatible = $ minPhpFulfilled && $ maxPhpFulfilled ;
128+ }
129+ if ($ minFulfilled && ($ this ->ignoreMaxVersion || $ maxFulfilled ) && $ isPhpCompatible ) {
112130 $ releases [] = $ release ;
113131 }
114132 } catch (\InvalidArgumentException $ e ) {
0 commit comments