Skip to content

Commit 198663d

Browse files
update php versions
1 parent 1b6cbc3 commit 198663d

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

profiling/src/php_ffi.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <dlfcn.h> // for dlsym
1111
#endif
1212

13-
#if PHP_VERSION_ID >= 70400
13+
#if PHP_VERSION_ID >= 70400 && PHP_VERSION_ID < 80400
1414
#define CFG_NEED_OPCODE_HANDLERS 1
1515
#else
1616
#define CFG_NEED_OPCODE_HANDLERS 0
@@ -108,23 +108,42 @@ static void ddog_php_prof_install_opcode_handlers(uint32_t php_version_id) {
108108
*/
109109
user_opcode_handler_t dispatch_handler = (user_opcode_handler_t)ddog_php_prof_opcode_dispatch;
110110

111+
#if PHP_VERSION_ID < 80100
111112
/* Issue is fixed in 8.0.26:
112113
* https://github.com/php/php-src/commit/26c7c82d32dad841dd151ebc6a31b8ea6f93f94a
113114
*/
114115
if (php_version_id < 80026 && zend_get_user_opcode_handler(ZEND_GENERATOR_CREATE) == NULL) {
115116
zend_set_user_opcode_handler(ZEND_GENERATOR_CREATE, dispatch_handler);
116117
}
118+
#endif
117119

120+
#if PHP_VERSION_ID < 80400
118121
/* Part of the issue was fixed in 8.0.12:
119122
* https://github.com/php/php-src/commit/ec54ffad1e3b15fedfd07f7d29d97ec3e8d1c45a
120123
* However, the fix is not complete as it's possible for the opcode to
121124
* call `zend_array_dup()` before the `SAVE_OPLINE()`.
125+
*
126+
* This was finally fixed with https://github.com/php/php-src/pull/12758 in
127+
* PHP 8.1.27, 8.2.14 and 8.3.1
122128
*/
123-
if (zend_get_user_opcode_handler(ZEND_BIND_STATIC) == NULL) {
129+
if ((php_version_id < 80127 ||
130+
(php_version_id >= 80200 && php_version_id < 80214) ||
131+
php_version_id == 80300) &&
132+
zend_get_user_opcode_handler(ZEND_BIND_STATIC) == NULL)
133+
{
124134
zend_set_user_opcode_handler(ZEND_BIND_STATIC, dispatch_handler);
125135
}
126-
#if PHP_VERSION_ID >= 80400
127-
#error Check if ZEND_BIND_STATIC needs an opcode handler still. Possibly update things like CFG_NEED_OPCODE_HANDLERS as well.
136+
137+
/* This was fixed with https://github.com/php/php-src/pull/12768 in
138+
* PHP 8.1.27, 8.2.14 and 8.3.1
139+
*/
140+
if ((php_version_id < 80127 ||
141+
(php_version_id >= 80200 && php_version_id < 80214) ||
142+
php_version_id == 80300) &&
143+
zend_get_user_opcode_handler(ZEND_FUNC_GET_ARGS) == NULL)
144+
{
145+
zend_set_user_opcode_handler(ZEND_FUNC_GET_ARGS, dispatch_handler);
146+
}
128147
#endif
129148
}
130149
#endif

0 commit comments

Comments
 (0)