You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x if((ApiVersion::Php80asu32)..(ApiVersion::Php81asu32)).contains(&x) => Ok(ApiVersion::Php80),
329
+
x if((ApiVersion::Php81asu32)..(ApiVersion::Php82asu32)).contains(&x) => Ok(ApiVersion::Php81),
330
+
x if((ApiVersion::Php82asu32)..(ApiVersion::Php83asu32)).contains(&x) => Ok(ApiVersion::Php82),
331
+
x if((ApiVersion::Php83asu32)..(ApiVersion::Php84asu32)).contains(&x) => Ok(ApiVersion::Php83),
332
+
x if(ApiVersion::Php84asu32) == x => Ok(ApiVersion::Php84),
333
+
version => Err(anyhow!(
334
+
"The current version of PHP is not supported. Current PHP API version: {}, requires a version between {} and {}",
335
+
version,
336
+
ApiVersion::min()asu32,
337
+
ApiVersion::max()asu32
338
+
))
339
+
}
340
+
}
341
+
}
342
+
252
343
/// Checks the PHP Zend API version for compatibility with ext-php-rs, setting
253
344
/// any configuration flags required.
254
345
fncheck_php_version(info:&PHPInfo) -> Result<()>{
255
-
constPHP_81_API_VER:u32 = 2021_09_02;
256
-
constPHP_82_API_VER:u32 = 2022_08_29;
257
-
constPHP_83_API_VER:u32 = 2023_08_31;
258
-
constPHP_84_API_VER:u32 = 2024_09_24;
259
-
260
346
let version = info.zend_version()?;
261
-
262
-
if !(MIN_PHP_API_VER..=MAX_PHP_API_VER).contains(&version){
263
-
bail!("The current version of PHP is not supported. Current PHP API version: {}, requires a version between {} and {}", version,MIN_PHP_API_VER,MAX_PHP_API_VER);
264
-
}
347
+
let version:ApiVersion = version.try_into()?;
265
348
266
349
// Infra cfg flags - use these for things that change in the Zend API that don't
267
350
// rely on a feature and the crate user won't care about (e.g. struct field
println!("cargo:warning=PHP version 8.0 is EOL and will no longer be supported in a future release. Please upgrade to a supported version of PHP. See https://www.php.net/supported-versions.php for information on version support timelines.");
362
+
if version == ApiVersion::Php80{
363
+
println!("cargo:warning=PHP 8.0 is EOL and will no longer be supported in a future release. Please upgrade to a supported version of PHP. See https://www.php.net/supported-versions.php for information on version support timelines.");
282
364
}
283
365
284
-
if version >= PHP_81_API_VER{
285
-
println!("cargo:rustc-cfg=php81");
286
-
}
287
-
288
-
if version >= PHP_82_API_VER{
289
-
println!("cargo:rustc-cfg=php82");
290
-
}
291
-
292
-
if version >= PHP_83_API_VER{
293
-
println!("cargo:rustc-cfg=php83");
294
-
}
295
-
296
-
if version >= PHP_84_API_VER{
297
-
println!("cargo:rustc-cfg=php84");
366
+
for supported_version in version.supported_apis(){
0 commit comments