summaryrefslogtreecommitdiff
path: root/ext/opcache/ZendAccelerator.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-05-19 15:01:18 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-05-20 11:20:21 +0200
commit0a74da385dd1cf25cf7870fdc82cbe1c7256fab3 (patch)
tree8c6efa7e8435c45a24d8bd3df99690679b557061 /ext/opcache/ZendAccelerator.h
parent1b1d313275c132dcfe03314933e4cdb996cea543 (diff)
downloadphp-git-0a74da385dd1cf25cf7870fdc82cbe1c7256fab3.tar.gz
Add support for replaying warnings in opcache
If opcache.record_warnings is enabled, opcache will record compilation warnings and replay them when the file is included again. The primary use case I have in mind for this is automated testing of the opcache file cache. This resolves bug #76535.
Diffstat (limited to 'ext/opcache/ZendAccelerator.h')
-rw-r--r--ext/opcache/ZendAccelerator.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 7dd9267e8f..05a05fa1b6 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -109,6 +109,13 @@ typedef enum _zend_accel_restart_reason {
ACCEL_RESTART_USER /* restart scheduled by opcache_reset() */
} zend_accel_restart_reason;
+typedef struct _zend_recorded_warning {
+ int type;
+ uint32_t error_lineno;
+ zend_string *error_filename;
+ zend_string *error_message;
+} zend_recorded_warning;
+
typedef struct _zend_persistent_script {
zend_script script;
zend_long compiler_halt_offset; /* position of __HALT_COMPILER or -1 */
@@ -117,6 +124,8 @@ typedef struct _zend_persistent_script {
zend_bool corrupted;
zend_bool is_phar;
zend_bool empty;
+ uint32_t num_warnings;
+ zend_recorded_warning **warnings;
void *mem; /* shared memory area used by script structures */
size_t size; /* size of used shared memory */
@@ -151,6 +160,7 @@ typedef struct _zend_accel_directives {
zend_bool validate_timestamps;
zend_bool revalidate_path;
zend_bool save_comments;
+ zend_bool record_warnings;
zend_bool protect_memory;
zend_bool file_override_enabled;
zend_bool enable_cli;
@@ -221,6 +231,10 @@ typedef struct _zend_accel_globals {
void *arena_mem;
zend_persistent_script *current_persistent_script;
zend_bool is_immutable_class;
+ /* Temporary storage for warnings before they are moved into persistent_script. */
+ zend_bool record_warnings;
+ uint32_t num_warnings;
+ zend_recorded_warning **warnings;
/* cache to save hash lookup on the same INCLUDE opcode */
const zend_op *cache_opline;
zend_persistent_script *cache_persistent_script;