Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ fn check_php_version(info: &PHPInfo) -> Result<()> {
// introduced in PHP 8.1).
//
// PHP 8.0 is the baseline - no feature flags will be introduced here.
//
// The PHP version cfg flags should also stack - if you compile on PHP 8.2 you
// should get both the `php81` and `php82` flags.
const PHP_81_API_VER: u32 = 20210902;

const PHP_82_API_VER: u32 = 20220829;
Expand All @@ -235,17 +232,20 @@ fn check_php_version(info: &PHPInfo) -> Result<()> {
println!(
"cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php84, php_zts, php_debug, docs)"
);
println!("cargo:rustc-cfg=php80");

if version < PHP_81_API_VER {
println!("cargo:rustc-cfg=php80");
}

if (PHP_81_API_VER..PHP_82_API_VER).contains(&version) {
println!("cargo:rustc-cfg=php81");
}

if version >= PHP_82_API_VER {
if (PHP_82_API_VER..PHP_83_API_VER).contains(&version) {
println!("cargo:rustc-cfg=php82");
}

if version >= PHP_83_API_VER {
if (PHP_83_API_VER..PHP_84_API_VER).contains(&version) {
println!("cargo:rustc-cfg=php83");
}

Expand Down
2 changes: 1 addition & 1 deletion src/builders/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl ClassBuilder {
// disable serialization if the class has an associated object
if self.object_override.is_some() {
cfg_if::cfg_if! {
if #[cfg(any(php81, php82))] {
if #[cfg(not(php80))] {
class.ce_flags |= ClassFlags::NotSerializable.bits();
} else {
class.serialize = Some(crate::ffi::zend_class_serialize_deny);
Expand Down
6 changes: 3 additions & 3 deletions src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use bitflags::bitflags;

#[cfg(not(php82))]
#[cfg(any(php80, php81))]
use crate::ffi::ZEND_ACC_REUSE_GET_ITERATOR;
use crate::ffi::{
CONST_CS, CONST_DEPRECATED, CONST_NO_FILE_CACHE, CONST_PERSISTENT, E_COMPILE_ERROR,
Expand Down Expand Up @@ -84,14 +84,14 @@ bitflags! {
const ConstantsUpdated = ZEND_ACC_CONSTANTS_UPDATED;
const NoDynamicProperties = ZEND_ACC_NO_DYNAMIC_PROPERTIES;
const HasStaticInMethods = ZEND_HAS_STATIC_IN_METHODS;
#[cfg(not(php82))]
#[cfg(any(php80, php81))]
const ReuseGetIterator = ZEND_ACC_REUSE_GET_ITERATOR;
const ResolvedParent = ZEND_ACC_RESOLVED_PARENT;
const ResolvedInterfaces = ZEND_ACC_RESOLVED_INTERFACES;
const UnresolvedVariance = ZEND_ACC_UNRESOLVED_VARIANCE;
const NearlyLinked = ZEND_ACC_NEARLY_LINKED;

#[cfg(any(php81,php82))]
#[cfg(not(php80))]
const NotSerializable = crate::ffi::ZEND_ACC_NOT_SERIALIZABLE;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/zend/_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl ZendType {
flags |= _ZEND_TYPE_NULLABLE_BIT
}
cfg_if::cfg_if! {
if #[cfg(php83)] {
if #[cfg(not(any(php80, php81, php82)))] {
flags |= crate::ffi::_ZEND_TYPE_LITERAL_NAME_BIT
} else {
flags |= crate::ffi::_ZEND_TYPE_NAME_BIT
Expand Down
6 changes: 3 additions & 3 deletions src/zend/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use parking_lot::{const_rwlock, RwLock, RwLockReadGuard, RwLockWriteGuard};

use crate::boxed::ZBox;
use crate::exception::PhpResult;
#[cfg(php82)]
#[cfg(not(any(php80, php81)))]
use crate::ffi::zend_atomic_bool_store;
use crate::ffi::{
_sapi_module_struct, _zend_executor_globals, ext_php_rs_executor_globals,
Expand Down Expand Up @@ -154,7 +154,7 @@ impl ExecutorGlobals {
/// set with [`crate::ffi::zend_interrupt_function`].
pub fn request_interrupt(&mut self) {
cfg_if::cfg_if! {
if #[cfg(php82)] {
if #[cfg(not(any(php80, php81)))] {
unsafe {
zend_atomic_bool_store(&mut self.vm_interrupt, true);
}
Expand All @@ -167,7 +167,7 @@ impl ExecutorGlobals {
/// Cancel a requested an interrupt of the PHP VM.
pub fn cancel_interrupt(&mut self) {
cfg_if::cfg_if! {
if #[cfg(php82)] {
if #[cfg(not(any(php80, php81)))] {
unsafe {
zend_atomic_bool_store(&mut self.vm_interrupt, false);
}
Expand Down