Skip to content
Merged
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
4 changes: 2 additions & 2 deletions profiling/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ fn build_zend_php_ffis(
.chain([Path::new("../zend_abstract_interface")])
.chain([Path::new("../")]),
)
.flag_if_supported("-std=c11")
.flag_if_supported("-std=c17");
.flag_if_supported("-std=gnu11")
.flag_if_supported("-std=gnu17");
#[cfg(feature = "test")]
build.define("CFG_TEST", "1");
build.compile("php_ffi");
Expand Down
4 changes: 3 additions & 1 deletion profiling/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,10 @@ unsafe extern "C" fn parse_profiling_enabled(

/// Display the profiling enabled config value
unsafe extern "C" fn display_profiling_enabled(ini_entry: *mut zend_ini_entry, type_: c_int) {
// PHP 8.6 changed this field from u8 to bool, so the cast is redundant only on older PHP.
#[allow(clippy::unnecessary_cast)]
let tmp_value: *mut zend_string =
if type_ as u32 == ZEND_INI_DISPLAY_ORIG && (*ini_entry).modified != 0 {
if type_ as u32 == ZEND_INI_DISPLAY_ORIG && (*ini_entry).modified as u8 != 0 {
if !(*ini_entry).orig_value.is_null() {
(*ini_entry).orig_value
} else {
Expand Down
6 changes: 4 additions & 2 deletions profiling/src/php_ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ bool ddog_php_jit_enabled() {
}

// Check opcache.jit_buffer_size, no buffer -> no JIT
char *buffer_size_str = zend_ini_string("opcache.jit_buffer_size", sizeof("opcache.jit_buffer_size") - 1, 0);
const char *buffer_size_str = zend_ini_string("opcache.jit_buffer_size", sizeof("opcache.jit_buffer_size") - 1, 0);
if (!buffer_size_str || strlen(buffer_size_str) == 0 || strcmp(buffer_size_str, "0") == 0) {
return false;
}
Expand All @@ -666,7 +666,7 @@ bool ddog_php_jit_enabled() {
}

// Finally check the opcache.jit setting
char *jit_str = zend_ini_string("opcache.jit", sizeof("opcache.jit") - 1, 0);
const char *jit_str = zend_ini_string("opcache.jit", sizeof("opcache.jit") - 1, 0);
if (!jit_str || strlen(jit_str) == 0 ||
strcmp(jit_str, "disable") == 0 ||
strcmp(jit_str, "off") == 0 ||
Expand All @@ -685,6 +685,8 @@ bool ddog_php_jit_enabled() {
#if PHP_VERSION_ID < 70200
#define zend_parse_parameters_none_throw() \
(EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : zend_parse_parameters_throw(ZEND_NUM_ARGS(), ""))
#elif PHP_VERSION_ID >= 80600
#define zend_parse_parameters_none_throw() zend_parse_parameters_none()
#endif

#if CFG_TRIGGER_TIME_SAMPLE
Expand Down
5 changes: 5 additions & 0 deletions profiling/src/php_ffi.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include <SAPI.h>
#if PHP_VERSION_ID >= 80600
#include <Zend/zend_compile.h>
#endif
#include <Zend/zend_extensions.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_types.h>
Expand Down Expand Up @@ -38,10 +41,12 @@
// Used to communicate strings from C -> Rust.
#include <zai_string/string.h>

#if PHP_VERSION_ID < 80600
/* C11 allows a duplicate typedef provided they are the same, so this should be
* fine as long as we compile with C11 or higher.
*/
typedef ZEND_RESULT_CODE zend_result;
#endif

/**
* Returns macro expansion of ZEND_EXTENSION_BUILD_ID, which bindgen cannot
Expand Down
Loading