Skip to content
Open
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
3 changes: 3 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ PHP 8.6 INTERNALS UPGRADE NOTES
"INF" and "NAN" fail, while leading-numeric strings emit E_WARNING. When
*failed is true, the returned value must not be used and an exception may
already be pending. Passing an IS_UNDEF zval is a caller error.
. Added the zend_accel_restart_hook callback, which OPcache calls once a
scheduled restart has been carried out, on the thread that carried it out,
with the same reason as the zend_accel_schedule_restart_hook callback.

========================
2. Build system changes
Expand Down
1 change: 1 addition & 0 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ ZEND_API zend_string *(*zend_resolve_path)(zend_string *filename);
ZEND_API zend_result (*zend_post_startup_cb)(void) = NULL;
ZEND_API void (*zend_post_shutdown_cb)(void) = NULL;
ZEND_API void (*zend_accel_schedule_restart_hook)(int reason) = NULL;
ZEND_API void (*zend_accel_restart_hook)(int reason) = NULL;
ZEND_ATTRIBUTE_NONNULL ZEND_API zend_result (*zend_random_bytes)(void *bytes, size_t size, char *errstr, size_t errstr_size) = NULL;
ZEND_ATTRIBUTE_NONNULL ZEND_API void (*zend_random_bytes_insecure)(zend_random_bytes_insecure_state *state, void *bytes, size_t size) = NULL;

Expand Down
3 changes: 3 additions & 0 deletions Zend/zend.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ extern ZEND_ATTRIBUTE_NONNULL ZEND_API void (*zend_random_bytes_insecure)(
extern ZEND_API zend_result (*zend_post_startup_cb)(void);
extern ZEND_API void (*zend_post_shutdown_cb)(void);

/* Called by opcache when a restart is scheduled, with a zend_accel_restart_reason */
extern ZEND_API void (*zend_accel_schedule_restart_hook)(int reason);
/* Called by opcache once a scheduled restart has been carried out, with the same reason */
extern ZEND_API void (*zend_accel_restart_hook)(int reason);

ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
Expand Down
4 changes: 4 additions & 0 deletions ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2970,6 +2970,10 @@ ZEND_RINIT_FUNCTION(zend_accelerator)
ZCSG(last_restart_time)++;
}
accel_restart_leave();

if (UNEXPECTED(zend_accel_restart_hook)) {
zend_accel_restart_hook(ZCSG(restart_reason));
}
}
}
zend_shared_alloc_unlock();
Expand Down
Loading