Skip to content

Commit 7eeb9c3

Browse files
mpociotdixyes
authored andcommitted
Add PHP 8.2 patch file
1 parent 483fbb8 commit 7eeb9c3

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

patches/static_opcache_82.patch

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
2+
index 1e71ea20..77895167 100644
3+
--- a/build/order_by_dep.awk
4+
+++ b/build/order_by_dep.awk
5+
@@ -37,6 +37,11 @@ function get_module_index(name, i)
6+
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
7+
{
8+
module_name = mods[mod_idx];
9+
+ # TODO: real skip zend extension
10+
+ if (module_name == "opcache") {
11+
+ delete mods[mod_idx];
12+
+ return;
13+
+ }
14+
mod_name_len = length(module_name);
15+
16+
for (ext in mod_deps) {
17+
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
18+
index 9bcd035c..7bc01614 100644
19+
--- a/ext/opcache/ZendAccelerator.c
20+
+++ b/ext/opcache/ZendAccelerator.c
21+
@@ -93,7 +93,10 @@ typedef int gid_t;
22+
#include <immintrin.h>
23+
#endif
24+
25+
+#ifdef COMPILE_DL_OPCACHE
26+
+// avoid symbol conflict
27+
ZEND_EXTENSION();
28+
+#endif
29+
30+
#ifndef ZTS
31+
zend_accel_globals accel_globals;
32+
@@ -4792,7 +4795,11 @@ static int accel_finish_startup(void)
33+
return SUCCESS;
34+
}
35+
36+
+#ifdef COMPILE_DL_OPCACHE
37+
ZEND_EXT_API zend_extension zend_extension_entry = {
38+
+#else
39+
+zend_extension opcache_zend_extension_entry = {
40+
+#endif
41+
ACCELERATOR_PRODUCT_NAME, /* name */
42+
PHP_VERSION, /* version */
43+
"Zend Technologies", /* author */
44+
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
45+
index b3929382..8607ff25 100644
46+
--- a/ext/opcache/config.m4
47+
+++ b/ext/opcache/config.m4
48+
@@ -21,7 +21,8 @@ PHP_ARG_ENABLE([opcache-jit],
49+
if test "$PHP_OPCACHE" != "no"; then
50+
51+
dnl Always build as shared extension
52+
- ext_shared=yes
53+
+ dnl why?
54+
+ dnl ext_shared=yes
55+
56+
if test "$PHP_HUGE_CODE_PAGES" = "yes"; then
57+
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
58+
@@ -336,7 +337,9 @@ int main(void) {
59+
shared_alloc_mmap.c \
60+
shared_alloc_posix.c \
61+
$ZEND_JIT_SRC,
62+
- shared,,"$PHP_OPCACHE_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
63+
+ $ext_shared,,"$PHP_OPCACHE_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
64+
+
65+
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
66+
67+
PHP_ADD_EXTENSION_DEP(opcache, pcre)
68+
69+
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
70+
index 764a2eda..95427090 100644
71+
--- a/ext/opcache/config.w32
72+
+++ b/ext/opcache/config.w32
73+
@@ -16,7 +16,9 @@ if (PHP_OPCACHE != "no") {
74+
zend_persist_calc.c \
75+
zend_file_cache.c \
76+
zend_shared_alloc.c \
77+
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
78+
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
79+
+
80+
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
81+
82+
if (PHP_OPCACHE_JIT == "yes") {
83+
if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
84+
diff --git a/main/main.c b/main/main.c
85+
index 0adecd10..ee89ebfb 100644
86+
--- a/main/main.c
87+
+++ b/main/main.c
88+
@@ -2048,6 +2048,18 @@ void dummy_invalid_parameter_handler(
89+
}
90+
#endif
91+
92+
+// this can be moved to other place
93+
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
94+
+extern zend_extension opcache_zend_extension_entry;
95+
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
96+
+
97+
+int zend_load_static_extensions(void)
98+
+{
99+
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
100+
+ return 0;
101+
+}
102+
+#endif
103+
+
104+
/* {{{ php_module_startup */
105+
zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_module)
106+
{
107+
@@ -2293,6 +2305,9 @@ zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additi
108+
ahead of all other internals
109+
*/
110+
php_ini_register_extensions();
111+
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
112+
+ zend_load_static_extensions();
113+
+#endif
114+
zend_startup_modules();
115+
116+
/* start Zend extensions */
117+
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
118+
index 4eece379..59b7bd5c 100644
119+
--- a/win32/build/confutils.js
120+
+++ b/win32/build/confutils.js
121+
@@ -1534,6 +1534,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
122+
}
123+
}
124+
125+
+ // TODO: real skip zend extensions
126+
+ if (extname != 'opcache')
127+
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
128+
129+
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');

0 commit comments

Comments
 (0)