Skip to content

Commit 49bd6f9

Browse files
committed
sixth round of fixes
Initialize extension handle for internal functions in PHP 8.4 to fix segfault when `opcache.jit=function`. PHP 8.4 includes observer API optimizations. One of the optimization requires extensions that use observer API, and use extension handle for user functions, to also initialize extension handle for internal functions - see php/php-src#14252.
1 parent 5131a2d commit 49bd6f9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

agent/php_minit.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,13 @@ PHP_MINIT_FUNCTION(newrelic) {
736736
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO /* PHP 8.0+ */
737737
NR_PHP_PROCESS_GLOBALS(zend_offset) = zend_get_resource_handle(dummy);
738738
NR_PHP_PROCESS_GLOBALS(op_array_extension_handle) = zend_get_op_array_extension_handle("newrelic");
739+
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO /* PHP 8.4+ */
740+
/* When observer API is used by an extension, both handles (for user
741+
* and internal functions) must be initialized, even when one of them
742+
* is not used (as in our case). Observer API was changed in PHP 8.4.
743+
* For more details see: https://github.com/php/php-src/pull/14252 */
744+
(void) zend_get_internal_function_extension_handle("newrelic");
745+
#endif
739746
#else
740747
NR_PHP_PROCESS_GLOBALS(zend_offset) = zend_get_resource_handle(&dummy);
741748
#endif

0 commit comments

Comments
 (0)