-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix zend_max_execution_timer.h cannot be included by the C++ extension. #16550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Zend/zend_max_execution_timer.h
Outdated
BEGIN_EXTERN_C() | ||
#include "zend_long.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the #include
outside of the BEGIN_EXTERN_C()
block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
The solution to avoid modifying this file is to add #ifdef __cplusplus
extern "C" {
#endif
#include "php.h"
#ifdef __cplusplus
}
#endif |
It is advisable not to add new header files in the release version. The file zend_max_execution_timer.h was added in PHP version 8.1.18RC1, whereas the PHP version in the Ubuntu 22.04 apt repository is 8.1.3. Consequently, using the zend_max_execution_timer API will result in a compilation failure on Ubuntu systems. |
@matyhtf Yes we know that but this is both a bug fix and a feature. Without this new system, timeouts are totally broken in multithreaded programs and there is nothing else we can do to fix that. This feature is off by default for PHP 8.1 if not compiled in ZTS mode, so the ABI didn't change for most users. |
|
||
BEGIN_EXTERN_C() | ||
/* Must be called after calls to fork() */ | ||
ZEND_API void zend_max_execution_timer_init(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this function must be called in extensions if they fork()
. It nay not be necessary to protect the two other definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, updated.
Thank you @matyhtf! |
In the Swoole extension, including zend_max_execution_timer.h and calling the zend_max_execution_timer_init function leads to an undefined symbol error. This function should be exported in C symbol format.