Skip to content

Conversation

wojrut-dt
Copy link

Hi, https://wiki.php.net/rfc/exit-as-function has impacted one of Dynatrace functionalities. When "exit" was an opcode it wasn't an issue, but now since the opcode is gone We must have a different way of access in order to keep Dynatrace fully compatible with PHP-8.4.x. I think making zend_exit function pointer and adding ZEND_API directive will solve the problem for us and won't break any third-party projects.

@Girgias
Copy link
Member

Girgias commented Oct 3, 2024

You should use zend_is_unwind_exit(EG(exception)) to check if exit() has been called. This API exist since 8.0.

@dstogov
Copy link
Member

dstogov commented Oct 3, 2024

I think you don't need this API.
In your extension MINIT (or post_statup callback), you may find zend_function corresponding to "exit" and override its internal handler.
Similar trick is implemented in opcache

if ((old_function = zend_hash_str_find_ptr(CG(function_table), "file_exists", sizeof("file_exists")-1)) != NULL) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants