@@ -101,14 +101,32 @@ protected function fetch($ETag, $content, $allowUnstable = false) {
101
101
// Exclude all versions not compatible with the current version
102
102
try {
103
103
$ versionParser = new VersionParser ();
104
- $ version = $ versionParser ->getVersion ($ release ['rawPlatformVersionSpec ' ]);
104
+ $ serverVersion = $ versionParser ->getVersion ($ release ['rawPlatformVersionSpec ' ]);
105
105
$ 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 ) {
112
130
$ releases [] = $ release ;
113
131
}
114
132
} catch (\InvalidArgumentException $ e ) {
0 commit comments