diff --git a/profiling/src/allocation/allocation_ge84.rs b/profiling/src/allocation/allocation_ge84.rs index 71b67da1d45..f20429946f7 100644 --- a/profiling/src/allocation/allocation_ge84.rs +++ b/profiling/src/allocation/allocation_ge84.rs @@ -7,6 +7,7 @@ use core::{cell::Cell, ptr}; use lazy_static::lazy_static; use libc::{c_char, c_void, size_t}; use log::{debug, error, trace, warn}; +use std::sync::atomic::Ordering::Relaxed; use std::sync::atomic::Ordering::SeqCst; #[derive(Copy, Clone)] @@ -143,8 +144,11 @@ lazy_static! { } pub fn first_rinit_should_disable_due_to_jit() -> bool { - if *JIT_ENABLED && zend::PHP_VERSION_ID >= 80400 { - error!("Memory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT. See https://github.com/DataDog/dd-trace-php/pull/3199"); + if *JIT_ENABLED + && zend::PHP_VERSION_ID >= 80400 + && (80400..80406).contains(&crate::RUNTIME_PHP_VERSION_ID.load(Relaxed)) + { + error!("Memory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT or upgrade PHP to at least version 8.4.7. See https://github.com/DataDog/dd-trace-php/pull/3199"); true } else { false diff --git a/profiling/tests/phpt/jit_03.phpt b/profiling/tests/phpt/jit_03.phpt index fbe544c3575..504b4481544 100644 --- a/profiling/tests/phpt/jit_03.phpt +++ b/profiling/tests/phpt/jit_03.phpt @@ -8,6 +8,8 @@ we make sure to disable allocation profiling when we detect the JIT is enabled. = 80407) + echo "skip: fixed since PHP version 8.4.7", PHP_EOL; if (!extension_loaded('datadog-profiling')) echo "skip: test requires datadog-profiling", PHP_EOL; if (php_uname("s") === "Darwin") @@ -27,5 +29,5 @@ opcache.jit_buffer_size=4M echo "Done.", PHP_EOL; ?> --EXPECTF-- -%aMemory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT. See https://github.com/DataDog/dd-trace-php/pull/3199 +%aMemory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT or upgrade PHP to at least version 8.4.7. See https://github.com/DataDog/dd-trace-php/pull/3199 %ADone.%a