Skip to content

Commit 8b6f14a

Browse files
authored
Compile in opcache without COMPILE_IGNORE_INTERNAL_CLASSES (#15025)
1 parent 8e93eb2 commit 8b6f14a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,13 +1809,20 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
18091809
zend_try {
18101810
orig_compiler_options = CG(compiler_options);
18111811
CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY;
1812-
CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES;
18131812
CG(compiler_options) |= ZEND_COMPILE_DELAYED_BINDING;
18141813
CG(compiler_options) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION;
18151814
CG(compiler_options) |= ZEND_COMPILE_IGNORE_OTHER_FILES;
18161815
CG(compiler_options) |= ZEND_COMPILE_IGNORE_OBSERVER;
1816+
#ifdef ZEND_WIN32
1817+
/* On Windows, don't compile with internal classes. Shm may be attached from different
1818+
* processes with internal classes living in different addresses. */
1819+
CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES;
1820+
#endif
18171821
if (ZCG(accel_directives).file_cache) {
18181822
CG(compiler_options) |= ZEND_COMPILE_WITH_FILE_CACHE;
1823+
/* Don't compile with internal classes for file cache, in case some extension is removed
1824+
* later on. We cannot assume it is there in the future. */
1825+
CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES;
18191826
}
18201827
op_array = *op_array_p = accelerator_orig_compile_file(file_handle, type);
18211828
CG(compiler_options) = orig_compiler_options;

0 commit comments

Comments
 (0)