mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 16:25:39 +08:00
v3 base
This commit is contained in:
95
src/globals/patch/php-src-patches/Readme.md
Normal file
95
src/globals/patch/php-src-patches/Readme.md
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
# 补丁 / Patches
|
||||
|
||||
名称 Name | 平台 Platform | 可选? Optional? | 用途 Usage
|
||||
--- | --- | --- | ---
|
||||
phar | * | 可选 Optional | 允许micro使用压缩phar Allow micro use compressed phar
|
||||
static_opcache | * | 可选 Optional | 支持静态构建opcache Support build opcache statically
|
||||
macos_iconv | macOS | 可选 Optional | 支持链接到系统的iconv Support link against system iconv
|
||||
static_extensions_win32 | Windows | 可选 Optional | 支持静态构建Windows其他扩展 Support build other extensions for windows
|
||||
cli_checks | * | 可选 Optional | 修改PHP内核中硬编码的SAPI检查 Modify hardcoden SAPI name checks in PHP core
|
||||
disable_huge_page | Linux | 可选 Optional | 禁用linux构建的max-page-size选项,缩减sfx体积(典型的, 10M+ -> 5M) Disable max-page-size for linux build,shrink sfx size (10M+ -> 5M typ.)
|
||||
vcruntime140 | Windows | 必须 Nessesary | 禁用sfx启动时GetModuleHandle(vcruntime140(d).dll) Disable GetModuleHandle(vcruntime140(d).dll) at sfx start
|
||||
win32 | Windows | 必须 Nessesary | 修改构建系统以静态构建 Modify build system for build sfx file
|
||||
zend_stream | Windows | 必须 Nessesary | 修改构建系统以静态构建 Modify build system for build sfx file
|
||||
comctl32 | Windows | 可选 Optional | 添加comctl32.dll manifest以启用[visual style](https://learn.microsoft.com/en-us/windows/win32/controls/visual-styles-overview) (会让窗口控件好看一些) Add manifest dependency for comctl32 to enable [visual style](https://learn.microsoft.com/en-us/windows/win32/controls/visual-styles-overview) (makes window control looks modern)
|
||||
win32_api | Windows | 必须 Necessary | 修复一些win32 api的声明 Fix declarations of some win32 apis
|
||||
|
||||
## Usage
|
||||
|
||||
目前补丁不需要特定顺序,使用
|
||||
|
||||
```bash
|
||||
# 在PHP源码目录
|
||||
patch -p1 < sapi/micro/patches/some_patch.patch
|
||||
```
|
||||
|
||||
来打patch
|
||||
|
||||
Currently, patches do not require a specific order. Use
|
||||
|
||||
```bash
|
||||
# at PHP source root
|
||||
patch -p1 < sapi/micro/patches/some_patch.patch
|
||||
```
|
||||
|
||||
to apply the patch.
|
||||
|
||||
### version choose
|
||||
|
||||
patch文件名为\<名称\>.patch或者\<名称\>_\<版本\>.patch,如果没有版本号,说明这个补丁支持所有目前micro支持的PHP版本
|
||||
|
||||
Patch file name is \<name\>.patch or \<name\>_\<version\>.patch. If there is no version number, it means that the patch supports all PHP versions that micro supports.
|
||||
|
||||
选择等于或者低于要打补丁的PHP版本的最新版本的patch,例如要给php 8.2打patch,有 80 81 84 三个patch, 则选择81
|
||||
|
||||
Choose the latest patch that is equal to or lower than the PHP version you want to patch. For example, if you want to patch PHP 8.2, and there are patches 80 81 84, choose 81.
|
||||
|
||||
所有的补丁都是给最新的修正版本使用的
|
||||
|
||||
All patches are applied to the latest patch version of its minor version.
|
||||
|
||||
## Something special
|
||||
|
||||
### phar.patch
|
||||
|
||||
这个patch绕过PHAR对micro的文件名中包含".phar"的限制(并不会允许micro本身以外的其他文件),这使得micro文件名中不含".phar"时依然可以使用压缩过的phar
|
||||
|
||||
This patch bypasses the restriction that a PHAR file must contain '.phar' in its filename when invoked with micro (it will not allow files other than the sfx to be regarded as phar). This allows micro to handle compressed phar files without a custom stub.
|
||||
|
||||
有特别的stub的PHAR不需要这个补丁也可以使用
|
||||
|
||||
phar with a stub (may be a special one) do not need this patch.
|
||||
|
||||
这个补丁只能在micro中使用,会导致其他SAPI编译不过
|
||||
|
||||
This patch can only be used with micro, as it causes other SAPIs to fail to build.
|
||||
|
||||
### static_opcache
|
||||
|
||||
静态链接opcache到PHP里,可以在其他的SAPI上用
|
||||
|
||||
This makes opcache statically linked into PHP, and it can be used for other SAPIs.
|
||||
|
||||
PHP 8.3.11, 8.2.23中,opcache的config.m4发生了[变动](https://github.com/php/php-src/commit/d20d11375fa602236e1fb828f6a2236b19b43cdc),这个patch对应变动后的版本
|
||||
|
||||
The opcache's config.m4 has [changed](https://github.com/php/php-src/commit/d20d11375fa602236e1fb828f6a2236b19b43cdc) in PHP 8.3.11 and 8.2.23, and this patch corresponds to the updated version.
|
||||
|
||||
### cli_checks
|
||||
|
||||
绕过许多硬编码的“是不是cli”的检查
|
||||
|
||||
This bypasses many hard-coded cli SAPI name checks.
|
||||
|
||||
### cli_static
|
||||
|
||||
允许Windows的cli静态构建,不是给micro用的
|
||||
|
||||
This allows the Windows cli SAPI to be built fully statically. It is not a patch for micro.
|
||||
|
||||
### win32_api
|
||||
|
||||
修复一些win32 api的声明,避免编译警告。这些修改已经在新版本 PHP (>=8.4)中合并,但保证旧版本也能用,这些补丁仍然需要
|
||||
|
||||
This fixes declarations of some win32 apis to avoid compilation warnings. These changes have been merged into newer versions of PHP (>=8.4), but to ensure that older versions can still be used, these patches are still needed.
|
||||
|
||||
174
src/globals/patch/php-src-patches/cli_checks_80.patch
Normal file
174
src/globals/patch/php-src-patches/cli_checks_80.patch
Normal file
@@ -0,0 +1,174 @@
|
||||
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
|
||||
index bc5a6b2e23..710515b6c1 100644
|
||||
--- a/TSRM/tsrm_win32.c
|
||||
+++ b/TSRM/tsrm_win32.c
|
||||
@@ -531,7 +531,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if (strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if (strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
|
||||
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
|
||||
index fc8bb9a1b0..2fd083d912 100644
|
||||
--- a/ext/ffi/ffi.c
|
||||
+++ b/ext/ffi/ffi.c
|
||||
@@ -4935,7 +4935,7 @@ ZEND_MINIT_FUNCTION(ffi)
|
||||
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
- FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "FFI", "Exception", NULL);
|
||||
zend_ffi_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_error);
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index c195ad7d2c..eef18fd10a 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -2622,7 +2622,7 @@ static inline int accel_find_sapi(void)
|
||||
}
|
||||
}
|
||||
if (ZCG(accel_directives).enable_cli && (
|
||||
- strcmp(sapi_module.name, "cli") == 0
|
||||
+ strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0
|
||||
|| strcmp(sapi_module.name, "phpdbg") == 0)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -2916,7 +2916,7 @@ static int accel_startup(zend_extension *extension)
|
||||
|
||||
#ifdef HAVE_HUGE_CODE_PAGES
|
||||
if (ZCG(accel_directives).huge_code_pages &&
|
||||
- (strcmp(sapi_module.name, "cli") == 0 ||
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0 ||
|
||||
strcmp(sapi_module.name, "cli-server") == 0 ||
|
||||
strcmp(sapi_module.name, "cgi-fcgi") == 0 ||
|
||||
strcmp(sapi_module.name, "fpm-fcgi") == 0)) {
|
||||
@@ -2928,7 +2928,7 @@ static int accel_startup(zend_extension *extension)
|
||||
if (accel_find_sapi() == FAILURE) {
|
||||
accel_startup_ok = 0;
|
||||
if (!ZCG(accel_directives).enable_cli &&
|
||||
- strcmp(sapi_module.name, "cli") == 0) {
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
|
||||
zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb);
|
||||
} else {
|
||||
zps_startup_failure("Opcode Caching is only supported in Apache, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb);
|
||||
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
|
||||
index d9b9d94c6f..744c715b38 100644
|
||||
--- a/ext/pcre/php_pcre.c
|
||||
+++ b/ext/pcre/php_pcre.c
|
||||
@@ -291,7 +291,7 @@ static PHP_GINIT_FUNCTION(pcre) /* {{{ */
|
||||
|
||||
/* If we're on the CLI SAPI, there will only be one request, so we don't need the
|
||||
* cache to survive after RSHUTDOWN. */
|
||||
- pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0;
|
||||
if (!pcre_globals->per_request_cache) {
|
||||
zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1);
|
||||
}
|
||||
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
|
||||
index 2930796ae7..20ad2706c7 100644
|
||||
--- a/ext/readline/readline_cli.c
|
||||
+++ b/ext/readline/readline_cli.c
|
||||
@@ -721,7 +721,7 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
|
||||
get_cli_shell_callbacks get_callbacks; \
|
||||
HMODULE hMod = GetModuleHandle("php.exe"); \
|
||||
(cb) = NULL; \
|
||||
- if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) { \
|
||||
+ if (0 == strncmp("cli", sapi_module.name, 3) || 0 == strncmp("micro", sapi_module.name, 5)) { \
|
||||
get_callbacks = (get_cli_shell_callbacks)GetProcAddress(hMod, "php_cli_get_shell_callbacks"); \
|
||||
if (get_callbacks) { \
|
||||
(cb) = get_callbacks(); \
|
||||
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
|
||||
index cd91e68fd3..f270eb5a15 100644
|
||||
--- a/ext/sqlite3/sqlite3.c
|
||||
+++ b/ext/sqlite3/sqlite3.c
|
||||
@@ -400,7 +400,7 @@ PHP_METHOD(SQLite3, loadExtension)
|
||||
|
||||
#ifdef ZTS
|
||||
if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
|
||||
- (strcmp(sapi_module.name, "cli") != 0) &&
|
||||
+ (strcmp(sapi_module.name, "cli") != 0) && (strcmp(sapi_module.name, "micro") != 0) &&
|
||||
(strncmp(sapi_module.name, "embed", 5) != 0)
|
||||
) { php_sqlite3_error(db_obj, "Not supported in multithreaded Web servers");
|
||||
RETURN_FALSE;
|
||||
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
|
||||
index c5743c3361..b2dd79f5c4 100644
|
||||
--- a/ext/standard/php_fopen_wrapper.c
|
||||
+++ b/ext/standard/php_fopen_wrapper.c
|
||||
@@ -242,7 +242,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_in = 0;
|
||||
fd = STDIN_FILENO;
|
||||
if (cli_in) {
|
||||
@@ -258,7 +258,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stdout")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_out = 0;
|
||||
fd = STDOUT_FILENO;
|
||||
if (cli_out++) {
|
||||
@@ -274,7 +274,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stderr")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_err = 0;
|
||||
fd = STDERR_FILENO;
|
||||
if (cli_err++) {
|
||||
@@ -295,7 +295,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
zend_long fildes_ori;
|
||||
int dtablesize;
|
||||
|
||||
- if (strcmp(sapi_module.name, "cli")) {
|
||||
+ if (strcmp(sapi_module.name, "cli") && strcmp(sapi_module.name, "micro")) {
|
||||
if (options & REPORT_ERRORS) {
|
||||
php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
|
||||
}
|
||||
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
|
||||
index 03b55c3eac..5bb0472f76 100644
|
||||
--- a/ext/standard/proc_open.c
|
||||
+++ b/ext/standard/proc_open.c
|
||||
@@ -1136,7 +1136,7 @@ PHP_FUNCTION(proc_open)
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if(strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if(strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
if (create_process_group) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index 7bd5400760..f0a71d7915 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -480,7 +480,7 @@ static PHP_INI_DISP(display_errors_mode)
|
||||
mode = php_get_display_errors_mode(tmp_value, tmp_value_length);
|
||||
|
||||
/* Display 'On' for other SAPIs instead of STDOUT or STDERR */
|
||||
- cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg"));
|
||||
+ cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro"));
|
||||
|
||||
switch (mode) {
|
||||
case PHP_DISPLAY_ERRORS_STDERR:
|
||||
diff --git a/win32/console.c b/win32/console.c
|
||||
index 7833dd97d3..1fa8e4cea9 100644
|
||||
--- a/win32/console.c
|
||||
+++ b/win32/console.c
|
||||
@@ -111,6 +111,6 @@ PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
|
||||
|
||||
PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void)
|
||||
{/*{{{*/
|
||||
- return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
|
||||
+ return !strncmp(sapi_module.name, "cli", sizeof("cli") - 1) || !strncmp(sapi_module.name, "micro", sizeof("micro") - 1);
|
||||
}/*}}}*/
|
||||
|
||||
183
src/globals/patch/php-src-patches/cli_checks_81.patch
Normal file
183
src/globals/patch/php-src-patches/cli_checks_81.patch
Normal file
@@ -0,0 +1,183 @@
|
||||
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
|
||||
index cfe344e377..7e1a5ca54f 100644
|
||||
--- a/TSRM/tsrm_win32.c
|
||||
+++ b/TSRM/tsrm_win32.c
|
||||
@@ -531,7 +531,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if (strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if (strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
|
||||
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
|
||||
index 8f05686367..c155028233 100644
|
||||
--- a/ext/ffi/ffi.c
|
||||
+++ b/ext/ffi/ffi.c
|
||||
@@ -5247,7 +5247,7 @@ ZEND_MINIT_FUNCTION(ffi)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
- FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 1;
|
||||
|
||||
zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error);
|
||||
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index 5f6b854d47..2b8362c412 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -2830,7 +2830,7 @@ static inline int accel_find_sapi(void)
|
||||
}
|
||||
if (ZCG(accel_directives).enable_cli && (
|
||||
strcmp(sapi_module.name, "cli") == 0
|
||||
- || strcmp(sapi_module.name, "phpdbg") == 0)) {
|
||||
+ || strcmp(sapi_module.name, "phpdbg") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -3128,7 +3128,7 @@ static int accel_startup(zend_extension *extension)
|
||||
|
||||
#ifdef HAVE_HUGE_CODE_PAGES
|
||||
if (ZCG(accel_directives).huge_code_pages &&
|
||||
- (strcmp(sapi_module.name, "cli") == 0 ||
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0 ||
|
||||
strcmp(sapi_module.name, "cli-server") == 0 ||
|
||||
strcmp(sapi_module.name, "cgi-fcgi") == 0 ||
|
||||
strcmp(sapi_module.name, "fpm-fcgi") == 0)) {
|
||||
@@ -3140,7 +3140,7 @@ static int accel_startup(zend_extension *extension)
|
||||
if (accel_find_sapi() == FAILURE) {
|
||||
accel_startup_ok = 0;
|
||||
if (!ZCG(accel_directives).enable_cli &&
|
||||
- strcmp(sapi_module.name, "cli") == 0) {
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
|
||||
zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb);
|
||||
} else {
|
||||
zps_startup_failure("Opcode Caching is only supported in Apache, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb);
|
||||
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
|
||||
index a8d3559ef5..1b40f94643 100644
|
||||
--- a/ext/pcre/php_pcre.c
|
||||
+++ b/ext/pcre/php_pcre.c
|
||||
@@ -291,7 +291,7 @@ static PHP_GINIT_FUNCTION(pcre) /* {{{ */
|
||||
|
||||
/* If we're on the CLI SAPI, there will only be one request, so we don't need the
|
||||
* cache to survive after RSHUTDOWN. */
|
||||
- pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0;
|
||||
if (!pcre_globals->per_request_cache) {
|
||||
zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1);
|
||||
}
|
||||
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
|
||||
index 8bf5d23df7..9af99ada0b 100644
|
||||
--- a/ext/readline/readline_cli.c
|
||||
+++ b/ext/readline/readline_cli.c
|
||||
@@ -735,7 +735,7 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
|
||||
get_cli_shell_callbacks get_callbacks; \
|
||||
HMODULE hMod = GetModuleHandle("php.exe"); \
|
||||
(cb) = NULL; \
|
||||
- if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) { \
|
||||
+ if ((strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) || 0 == strcmp("micro", sapi_module.name)) { \
|
||||
get_callbacks = (get_cli_shell_callbacks)GetProcAddress(hMod, "php_cli_get_shell_callbacks"); \
|
||||
if (get_callbacks) { \
|
||||
(cb) = get_callbacks(); \
|
||||
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
|
||||
index 007eef7a74..86d75103c8 100644
|
||||
--- a/ext/sqlite3/sqlite3.c
|
||||
+++ b/ext/sqlite3/sqlite3.c
|
||||
@@ -399,7 +399,7 @@ PHP_METHOD(SQLite3, loadExtension)
|
||||
|
||||
#ifdef ZTS
|
||||
if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
|
||||
- (strcmp(sapi_module.name, "cli") != 0) &&
|
||||
+ (strcmp(sapi_module.name, "cli") != 0) && (strcmp(sapi_module.name, "micro") != 0) &&
|
||||
(strncmp(sapi_module.name, "embed", 5) != 0)
|
||||
) { php_sqlite3_error(db_obj, "Not supported in multithreaded Web servers");
|
||||
RETURN_FALSE;
|
||||
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
|
||||
index 4287045511..eab0311d07 100644
|
||||
--- a/ext/standard/php_fopen_wrapper.c
|
||||
+++ b/ext/standard/php_fopen_wrapper.c
|
||||
@@ -242,7 +242,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_in = 0;
|
||||
fd = STDIN_FILENO;
|
||||
if (cli_in) {
|
||||
@@ -258,7 +258,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stdout")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_out = 0;
|
||||
fd = STDOUT_FILENO;
|
||||
if (cli_out++) {
|
||||
@@ -274,7 +274,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stderr")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_err = 0;
|
||||
fd = STDERR_FILENO;
|
||||
if (cli_err++) {
|
||||
@@ -295,7 +295,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
zend_long fildes_ori;
|
||||
int dtablesize;
|
||||
|
||||
- if (strcmp(sapi_module.name, "cli")) {
|
||||
+ if (strcmp(sapi_module.name, "cli") || strcmp(sapi_module.name, "micro")) {
|
||||
if (options & REPORT_ERRORS) {
|
||||
php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
|
||||
}
|
||||
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
|
||||
index a57e66bd97..e9044cd34e 100644
|
||||
--- a/ext/standard/proc_open.c
|
||||
+++ b/ext/standard/proc_open.c
|
||||
@@ -1135,7 +1135,7 @@ PHP_FUNCTION(proc_open)
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if(strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if(strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
if (create_process_group) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index dc705fcdbd..a206aa11e4 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -475,7 +475,7 @@ static PHP_INI_DISP(display_errors_mode)
|
||||
mode = php_get_display_errors_mode(temporary_value);
|
||||
|
||||
/* Display 'On' for other SAPIs instead of STDOUT or STDERR */
|
||||
- cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg"));
|
||||
+ cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro"));
|
||||
|
||||
switch (mode) {
|
||||
case PHP_DISPLAY_ERRORS_STDERR:
|
||||
@@ -1340,7 +1340,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
|
||||
}
|
||||
} else {
|
||||
/* Write CLI/CGI errors to stderr if display_errors = "stderr" */
|
||||
- if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg")) &&
|
||||
+ if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro")) &&
|
||||
PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR
|
||||
) {
|
||||
fprintf(stderr, "%s: %s in %s on line %" PRIu32 "\n", error_type_str, ZSTR_VAL(message), ZSTR_VAL(error_filename), error_lineno);
|
||||
diff --git a/win32/console.c b/win32/console.c
|
||||
index 9b48561088..a2b764cdb5 100644
|
||||
--- a/win32/console.c
|
||||
+++ b/win32/console.c
|
||||
@@ -111,6 +111,6 @@ PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
|
||||
|
||||
PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void)
|
||||
{/*{{{*/
|
||||
- return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
|
||||
+ return (strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1)) || 0 == strcmp(sapi_module.name, "micro");
|
||||
}/*}}}*/
|
||||
|
||||
192
src/globals/patch/php-src-patches/cli_checks_83.patch
Normal file
192
src/globals/patch/php-src-patches/cli_checks_83.patch
Normal file
@@ -0,0 +1,192 @@
|
||||
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
|
||||
index dc8f9fefa3..057d76229e 100644
|
||||
--- a/TSRM/tsrm_win32.c
|
||||
+++ b/TSRM/tsrm_win32.c
|
||||
@@ -530,7 +530,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if (strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if (strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
|
||||
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
|
||||
index bbfe07576e..398373d577 100644
|
||||
--- a/ext/ffi/ffi.c
|
||||
+++ b/ext/ffi/ffi.c
|
||||
@@ -5402,7 +5402,7 @@ ZEND_MINIT_FUNCTION(ffi)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
- FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 1;
|
||||
|
||||
zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error);
|
||||
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index a21c640d91..3af0e89b21 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -2822,7 +2822,7 @@ static inline zend_result accel_find_sapi(void)
|
||||
}
|
||||
if (ZCG(accel_directives).enable_cli && (
|
||||
strcmp(sapi_module.name, "cli") == 0
|
||||
- || strcmp(sapi_module.name, "phpdbg") == 0)) {
|
||||
+ || strcmp(sapi_module.name, "phpdbg") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -3127,7 +3127,7 @@ static int accel_startup(zend_extension *extension)
|
||||
|
||||
#ifdef HAVE_HUGE_CODE_PAGES
|
||||
if (ZCG(accel_directives).huge_code_pages &&
|
||||
- (strcmp(sapi_module.name, "cli") == 0 ||
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0 ||
|
||||
strcmp(sapi_module.name, "cli-server") == 0 ||
|
||||
strcmp(sapi_module.name, "cgi-fcgi") == 0 ||
|
||||
strcmp(sapi_module.name, "fpm-fcgi") == 0)) {
|
||||
@@ -3139,7 +3139,7 @@ static int accel_startup(zend_extension *extension)
|
||||
if (accel_find_sapi() == FAILURE) {
|
||||
accel_startup_ok = false;
|
||||
if (!ZCG(accel_directives).enable_cli &&
|
||||
- strcmp(sapi_module.name, "cli") == 0) {
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
|
||||
zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb);
|
||||
} else {
|
||||
zps_startup_failure("Opcode Caching is only supported in Apache, FPM, FastCGI, FrankenPHP, LiteSpeed and uWSGI SAPIs", NULL, accelerator_remove_cb);
|
||||
@@ -4681,7 +4681,7 @@ static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)
|
||||
if (!ZCG(accel_directives).preload_user
|
||||
|| !*ZCG(accel_directives).preload_user) {
|
||||
|
||||
- bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0
|
||||
+ bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0
|
||||
|| strcmp(sapi_module.name, "phpdbg") == 0);
|
||||
|
||||
if (!sapi_requires_preload_user) {
|
||||
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
|
||||
index 6ad0b6eb76..7c9861678f 100644
|
||||
--- a/ext/pcre/php_pcre.c
|
||||
+++ b/ext/pcre/php_pcre.c
|
||||
@@ -300,7 +300,7 @@ static PHP_GINIT_FUNCTION(pcre) /* {{{ */
|
||||
|
||||
/* If we're on the CLI SAPI, there will only be one request, so we don't need the
|
||||
* cache to survive after RSHUTDOWN. */
|
||||
- pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0;
|
||||
if (!pcre_globals->per_request_cache) {
|
||||
zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1);
|
||||
}
|
||||
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
|
||||
index 8fbe93d648..3c14946e58 100644
|
||||
--- a/ext/readline/readline_cli.c
|
||||
+++ b/ext/readline/readline_cli.c
|
||||
@@ -736,7 +736,7 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
|
||||
get_cli_shell_callbacks get_callbacks; \
|
||||
HMODULE hMod = GetModuleHandle("php.exe"); \
|
||||
(cb) = NULL; \
|
||||
- if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) { \
|
||||
+ if ((strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) || 0 == strcmp("micro", sapi_module.name)) { \
|
||||
get_callbacks = (get_cli_shell_callbacks)GetProcAddress(hMod, "php_cli_get_shell_callbacks"); \
|
||||
if (get_callbacks) { \
|
||||
(cb) = get_callbacks(); \
|
||||
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
|
||||
index badcfcc29b..70d4d5423e 100644
|
||||
--- a/ext/sqlite3/sqlite3.c
|
||||
+++ b/ext/sqlite3/sqlite3.c
|
||||
@@ -402,7 +402,7 @@ PHP_METHOD(SQLite3, loadExtension)
|
||||
|
||||
#ifdef ZTS
|
||||
if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
|
||||
- (strcmp(sapi_module.name, "cli") != 0) &&
|
||||
+ (strcmp(sapi_module.name, "cli") != 0) && (strcmp(sapi_module.name, "micro") != 0) &&
|
||||
(strncmp(sapi_module.name, "embed", 5) != 0)
|
||||
) { php_sqlite3_error(db_obj, 0, "Not supported in multithreaded Web servers");
|
||||
RETURN_FALSE;
|
||||
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
|
||||
index 8926485025..6740163bc5 100644
|
||||
--- a/ext/standard/php_fopen_wrapper.c
|
||||
+++ b/ext/standard/php_fopen_wrapper.c
|
||||
@@ -242,7 +242,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_in = 0;
|
||||
fd = STDIN_FILENO;
|
||||
if (cli_in) {
|
||||
@@ -258,7 +258,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stdout")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_out = 0;
|
||||
fd = STDOUT_FILENO;
|
||||
if (cli_out++) {
|
||||
@@ -274,7 +274,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stderr")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_err = 0;
|
||||
fd = STDERR_FILENO;
|
||||
if (cli_err++) {
|
||||
@@ -295,7 +295,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
zend_long fildes_ori;
|
||||
int dtablesize;
|
||||
|
||||
- if (strcmp(sapi_module.name, "cli")) {
|
||||
+ if (strcmp(sapi_module.name, "cli") || strcmp(sapi_module.name, "micro")) {
|
||||
if (options & REPORT_ERRORS) {
|
||||
php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
|
||||
}
|
||||
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
|
||||
index 2d4cb42b7a..726d995dc0 100644
|
||||
--- a/ext/standard/proc_open.c
|
||||
+++ b/ext/standard/proc_open.c
|
||||
@@ -1280,7 +1280,7 @@ PHP_FUNCTION(proc_open)
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if(strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if(strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
if (create_process_group) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index 3c9c55129e..cb8fb42eea 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -486,7 +486,7 @@ static PHP_INI_DISP(display_errors_mode)
|
||||
mode = php_get_display_errors_mode(temporary_value);
|
||||
|
||||
/* Display 'On' for other SAPIs instead of STDOUT or STDERR */
|
||||
- cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg"));
|
||||
+ cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro"));
|
||||
|
||||
switch (mode) {
|
||||
case PHP_DISPLAY_ERRORS_STDERR:
|
||||
@@ -1367,7 +1367,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
|
||||
}
|
||||
} else {
|
||||
/* Write CLI/CGI errors to stderr if display_errors = "stderr" */
|
||||
- if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg")) &&
|
||||
+ if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro")) &&
|
||||
PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR
|
||||
) {
|
||||
fprintf(stderr, "%s: ", error_type_str);
|
||||
diff --git a/win32/console.c b/win32/console.c
|
||||
index 9b48561088..a2b764cdb5 100644
|
||||
--- a/win32/console.c
|
||||
+++ b/win32/console.c
|
||||
@@ -111,6 +111,6 @@ PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
|
||||
|
||||
PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void)
|
||||
{/*{{{*/
|
||||
- return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
|
||||
+ return (strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1)) || 0 == strcmp(sapi_module.name, "micro");
|
||||
}/*}}}*/
|
||||
|
||||
191
src/globals/patch/php-src-patches/cli_checks_84.patch
Normal file
191
src/globals/patch/php-src-patches/cli_checks_84.patch
Normal file
@@ -0,0 +1,191 @@
|
||||
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
|
||||
index dc8f9fefa3..057d76229e 100644
|
||||
--- a/TSRM/tsrm_win32.c
|
||||
+++ b/TSRM/tsrm_win32.c
|
||||
@@ -530,7 +530,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if (strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if (strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
|
||||
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
|
||||
index d797f5f93f..27cb05e3e4 100644
|
||||
--- a/ext/ffi/ffi.c
|
||||
+++ b/ext/ffi/ffi.c
|
||||
@@ -5403,7 +5403,7 @@ ZEND_MINIT_FUNCTION(ffi)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
- FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 1;
|
||||
|
||||
zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error);
|
||||
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index 8d45b2ae41..35e9403a31 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -2822,7 +2822,7 @@ static inline zend_result accel_find_sapi(void)
|
||||
}
|
||||
if (ZCG(accel_directives).enable_cli && (
|
||||
strcmp(sapi_module.name, "cli") == 0
|
||||
- || strcmp(sapi_module.name, "phpdbg") == 0)) {
|
||||
+ || strcmp(sapi_module.name, "phpdbg") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -3134,7 +3134,7 @@ static int accel_startup(zend_extension *extension)
|
||||
|
||||
#ifdef HAVE_HUGE_CODE_PAGES
|
||||
if (ZCG(accel_directives).huge_code_pages &&
|
||||
- (strcmp(sapi_module.name, "cli") == 0 ||
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0 ||
|
||||
strcmp(sapi_module.name, "cli-server") == 0 ||
|
||||
strcmp(sapi_module.name, "cgi-fcgi") == 0 ||
|
||||
strcmp(sapi_module.name, "fpm-fcgi") == 0)) {
|
||||
@@ -3146,7 +3146,7 @@ static int accel_startup(zend_extension *extension)
|
||||
if (accel_find_sapi() == FAILURE) {
|
||||
accel_startup_ok = false;
|
||||
if (!ZCG(accel_directives).enable_cli &&
|
||||
- strcmp(sapi_module.name, "cli") == 0) {
|
||||
+ (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
|
||||
zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb);
|
||||
} else {
|
||||
zps_startup_failure("Opcode Caching is only supported in Apache, FPM, FastCGI, FrankenPHP, LiteSpeed and uWSGI SAPIs", NULL, accelerator_remove_cb);
|
||||
@@ -4685,7 +4685,7 @@ static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)
|
||||
if (!ZCG(accel_directives).preload_user
|
||||
|| !*ZCG(accel_directives).preload_user) {
|
||||
|
||||
- bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0
|
||||
+ bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0
|
||||
|| strcmp(sapi_module.name, "phpdbg") == 0);
|
||||
|
||||
if (!sapi_requires_preload_user) {
|
||||
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
|
||||
index 49a477998b..18fe71cce4 100644
|
||||
--- a/ext/pdo_sqlite/pdo_sqlite.c
|
||||
+++ b/ext/pdo_sqlite/pdo_sqlite.c
|
||||
@@ -94,6 +94,7 @@ PHP_METHOD(Pdo_Sqlite, loadExtension)
|
||||
#ifdef ZTS
|
||||
if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
|
||||
(strcmp(sapi_module.name, "cli") != 0) &&
|
||||
+ (strcmp(sapi_module.name, "micro") != 0) &&
|
||||
(strncmp(sapi_module.name, "embed", 5) != 0)
|
||||
) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "Not supported in multithreaded Web servers");
|
||||
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
|
||||
index 80ddd88f7d..7b37aaff0b 100644
|
||||
--- a/ext/readline/readline_cli.c
|
||||
+++ b/ext/readline/readline_cli.c
|
||||
@@ -730,7 +730,7 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
|
||||
get_cli_shell_callbacks get_callbacks; \
|
||||
HMODULE hMod = GetModuleHandle("php.exe"); \
|
||||
(cb) = NULL; \
|
||||
- if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) { \
|
||||
+ if ((strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) || 0 == strcmp("micro", sapi_module.name)) { \
|
||||
get_callbacks = (get_cli_shell_callbacks)GetProcAddress(hMod, "php_cli_get_shell_callbacks"); \
|
||||
if (get_callbacks) { \
|
||||
(cb) = get_callbacks(); \
|
||||
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
|
||||
index 0f26593b85..5f253f0061 100644
|
||||
--- a/ext/sqlite3/sqlite3.c
|
||||
+++ b/ext/sqlite3/sqlite3.c
|
||||
@@ -408,7 +408,7 @@ PHP_METHOD(SQLite3, loadExtension)
|
||||
|
||||
#ifdef ZTS
|
||||
if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
|
||||
- (strcmp(sapi_module.name, "cli") != 0) &&
|
||||
+ (strcmp(sapi_module.name, "cli") != 0) && (strcmp(sapi_module.name, "micro") != 0) &&
|
||||
(strncmp(sapi_module.name, "embed", 5) != 0)
|
||||
) { php_sqlite3_error(db_obj, 0, "Not supported in multithreaded Web servers");
|
||||
RETURN_FALSE;
|
||||
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
|
||||
index a5581d9ccc..98455f7b52 100644
|
||||
--- a/ext/standard/php_fopen_wrapper.c
|
||||
+++ b/ext/standard/php_fopen_wrapper.c
|
||||
@@ -242,7 +242,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_in = 0;
|
||||
fd = STDIN_FILENO;
|
||||
if (cli_in) {
|
||||
@@ -258,7 +258,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stdout")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_out = 0;
|
||||
fd = STDOUT_FILENO;
|
||||
if (cli_out++) {
|
||||
@@ -274,7 +274,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stderr")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_err = 0;
|
||||
fd = STDERR_FILENO;
|
||||
if (cli_err++) {
|
||||
@@ -295,7 +295,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
zend_long fildes_ori;
|
||||
int dtablesize;
|
||||
|
||||
- if (strcmp(sapi_module.name, "cli")) {
|
||||
+ if (strcmp(sapi_module.name, "cli") || strcmp(sapi_module.name, "micro")) {
|
||||
if (options & REPORT_ERRORS) {
|
||||
php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
|
||||
}
|
||||
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
|
||||
index d935f9d216..bac478144d 100644
|
||||
--- a/ext/standard/proc_open.c
|
||||
+++ b/ext/standard/proc_open.c
|
||||
@@ -1274,7 +1274,7 @@ PHP_FUNCTION(proc_open)
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if(strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if(strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
if (create_process_group) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index a3acaf94b7..7ac56f9919 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -486,7 +486,7 @@ static PHP_INI_DISP(display_errors_mode)
|
||||
mode = php_get_display_errors_mode(temporary_value);
|
||||
|
||||
/* Display 'On' for other SAPIs instead of STDOUT or STDERR */
|
||||
- cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg"));
|
||||
+ cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro"));
|
||||
|
||||
switch (mode) {
|
||||
case PHP_DISPLAY_ERRORS_STDERR:
|
||||
@@ -1371,7 +1371,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
|
||||
}
|
||||
} else {
|
||||
/* Write CLI/CGI errors to stderr if display_errors = "stderr" */
|
||||
- if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg")) &&
|
||||
+ if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro")) &&
|
||||
PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR
|
||||
) {
|
||||
fprintf(stderr, "%s: ", error_type_str);
|
||||
diff --git a/win32/console.c b/win32/console.c
|
||||
index 9b48561088..a2b764cdb5 100644
|
||||
--- a/win32/console.c
|
||||
+++ b/win32/console.c
|
||||
@@ -111,6 +111,6 @@ PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
|
||||
|
||||
PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void)
|
||||
{/*{{{*/
|
||||
- return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
|
||||
+ return (strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1)) || 0 == strcmp(sapi_module.name, "micro");
|
||||
}/*}}}*/
|
||||
|
||||
178
src/globals/patch/php-src-patches/cli_checks_85.patch
Normal file
178
src/globals/patch/php-src-patches/cli_checks_85.patch
Normal file
@@ -0,0 +1,178 @@
|
||||
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
|
||||
index 4c8fc9d1..8284ac2f 100644
|
||||
--- a/TSRM/tsrm_win32.c
|
||||
+++ b/TSRM/tsrm_win32.c
|
||||
@@ -535,7 +535,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if (strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if (strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
|
||||
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
|
||||
index 10fc11f5..eb4d4175 100644
|
||||
--- a/ext/ffi/ffi.c
|
||||
+++ b/ext/ffi/ffi.c
|
||||
@@ -5478,7 +5478,7 @@ ZEND_MINIT_FUNCTION(ffi)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
- FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0;
|
||||
+ FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 1;
|
||||
|
||||
zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error);
|
||||
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index f597df36..ec617af7 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -2847,6 +2847,7 @@ static void zps_startup_failure(const char *reason, const char *api_reason, int
|
||||
static inline bool accel_sapi_is_cli(void)
|
||||
{
|
||||
return strcmp(sapi_module.name, "cli") == 0
|
||||
+ || strcmp(sapi_module.name, "micro") == 0
|
||||
|| strcmp(sapi_module.name, "phpdbg") == 0;
|
||||
}
|
||||
|
||||
@@ -3163,6 +3164,7 @@ static int accel_startup(zend_extension *extension)
|
||||
#ifdef HAVE_HUGE_CODE_PAGES
|
||||
if (ZCG(accel_directives).huge_code_pages &&
|
||||
(strcmp(sapi_module.name, "cli") == 0 ||
|
||||
+ strcmp(sapi_module.name, "micro") == 0 ||
|
||||
strcmp(sapi_module.name, "cli-server") == 0 ||
|
||||
strcmp(sapi_module.name, "cgi-fcgi") == 0 ||
|
||||
strcmp(sapi_module.name, "fpm-fcgi") == 0)) {
|
||||
@@ -4958,6 +4960,7 @@ static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)
|
||||
|| !*ZCG(accel_directives).preload_user) {
|
||||
|
||||
bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0
|
||||
+ || strcmp(sapi_module.name, "micro") == 0
|
||||
|| strcmp(sapi_module.name, "phpdbg") == 0);
|
||||
|
||||
if (!sapi_requires_preload_user) {
|
||||
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
|
||||
index 023e35a2..6f00159a 100644
|
||||
--- a/ext/pdo_sqlite/pdo_sqlite.c
|
||||
+++ b/ext/pdo_sqlite/pdo_sqlite.c
|
||||
@@ -94,6 +94,7 @@ PHP_METHOD(Pdo_Sqlite, loadExtension)
|
||||
#ifdef ZTS
|
||||
if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
|
||||
(strcmp(sapi_module.name, "cli") != 0) &&
|
||||
+ (strcmp(sapi_module.name, "micro") != 0) &&
|
||||
(strncmp(sapi_module.name, "embed", 5) != 0)
|
||||
) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "Not supported in multithreaded Web servers");
|
||||
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
|
||||
index 31212999..d7705d59 100644
|
||||
--- a/ext/readline/readline_cli.c
|
||||
+++ b/ext/readline/readline_cli.c
|
||||
@@ -730,7 +730,7 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
|
||||
get_cli_shell_callbacks get_callbacks; \
|
||||
HMODULE hMod = GetModuleHandle("php.exe"); \
|
||||
(cb) = NULL; \
|
||||
- if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) { \
|
||||
+ if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3) || 0 == strcmp("micro", sapi_module.name)) { \
|
||||
get_callbacks = (get_cli_shell_callbacks)GetProcAddress(hMod, "php_cli_get_shell_callbacks"); \
|
||||
if (get_callbacks) { \
|
||||
(cb) = get_callbacks(); \
|
||||
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
|
||||
index 21b6840a..05a7aa8e 100644
|
||||
--- a/ext/sqlite3/sqlite3.c
|
||||
+++ b/ext/sqlite3/sqlite3.c
|
||||
@@ -413,6 +413,7 @@ PHP_METHOD(SQLite3, loadExtension)
|
||||
#ifdef ZTS
|
||||
if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
|
||||
(strcmp(sapi_module.name, "cli") != 0) &&
|
||||
+ (strcmp(sapi_module.name, "micro") != 0) &&
|
||||
(strncmp(sapi_module.name, "embed", 5) != 0)
|
||||
) { php_sqlite3_error(db_obj, 0, "Not supported in multithreaded Web servers");
|
||||
RETURN_FALSE;
|
||||
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
|
||||
index ea33ba49..083184b8 100644
|
||||
--- a/ext/standard/php_fopen_wrapper.c
|
||||
+++ b/ext/standard/php_fopen_wrapper.c
|
||||
@@ -242,7 +242,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_in = 0;
|
||||
fd = STDIN_FILENO;
|
||||
if (cli_in) {
|
||||
@@ -258,7 +258,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stdout")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_out = 0;
|
||||
fd = STDOUT_FILENO;
|
||||
if (cli_out++) {
|
||||
@@ -274,7 +274,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
pipe_requested = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(path, "stderr")) {
|
||||
- if (!strcmp(sapi_module.name, "cli")) {
|
||||
+ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) {
|
||||
static int cli_err = 0;
|
||||
fd = STDERR_FILENO;
|
||||
if (cli_err++) {
|
||||
@@ -295,7 +295,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
|
||||
zend_long fildes_ori;
|
||||
int dtablesize;
|
||||
|
||||
- if (strcmp(sapi_module.name, "cli")) {
|
||||
+ if (strcmp(sapi_module.name, "cli") || strcmp(sapi_module.name, "micro")) {
|
||||
if (options & REPORT_ERRORS) {
|
||||
php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
|
||||
}
|
||||
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
|
||||
index 690e23e0..80ab3d32 100644
|
||||
--- a/ext/standard/proc_open.c
|
||||
+++ b/ext/standard/proc_open.c
|
||||
@@ -1333,7 +1333,7 @@ PHP_FUNCTION(proc_open)
|
||||
}
|
||||
|
||||
dwCreateFlags = NORMAL_PRIORITY_CLASS;
|
||||
- if(strcmp(sapi_module.name, "cli") != 0) {
|
||||
+ if(strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
|
||||
dwCreateFlags |= CREATE_NO_WINDOW;
|
||||
}
|
||||
if (create_process_group) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index 8465b6c0..cf8f9ef0 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -580,7 +580,7 @@ static PHP_INI_DISP(display_errors_mode)
|
||||
mode = php_get_display_errors_mode(temporary_value);
|
||||
|
||||
/* Display 'On' for other SAPIs instead of STDOUT or STDERR */
|
||||
- cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg"));
|
||||
+ cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro"));
|
||||
|
||||
switch (mode) {
|
||||
case PHP_DISPLAY_ERRORS_STDERR:
|
||||
@@ -1470,7 +1470,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
|
||||
}
|
||||
} else {
|
||||
/* Write CLI/CGI errors to stderr if display_errors = "stderr" */
|
||||
- if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg")) &&
|
||||
+ if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro")) &&
|
||||
PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR
|
||||
) {
|
||||
fprintf(stderr, "%s: ", error_type_str);
|
||||
diff --git a/win32/console.c b/win32/console.c
|
||||
index 9b485610..a2b764cd 100644
|
||||
--- a/win32/console.c
|
||||
+++ b/win32/console.c
|
||||
@@ -111,6 +111,6 @@ PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
|
||||
|
||||
PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void)
|
||||
{/*{{{*/
|
||||
- return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
|
||||
+ return (strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1)) || 0 == strcmp(sapi_module.name, "micro");
|
||||
}/*}}}*/
|
||||
|
||||
24
src/globals/patch/php-src-patches/cli_static_80.patch
Normal file
24
src/globals/patch/php-src-patches/cli_static_80.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
|
||||
index 0ad53e813c..a8cc1bee29 100644
|
||||
--- a/sapi/cli/php_cli.c
|
||||
+++ b/sapi/cli/php_cli.c
|
||||
@@ -97,7 +97,7 @@ PHPAPI extern char *php_ini_scanned_files;
|
||||
|
||||
#if defined(PHP_WIN32)
|
||||
#if defined(ZTS)
|
||||
-ZEND_TSRMLS_CACHE_DEFINE()
|
||||
+//ZEND_TSRMLS_CACHE_DEFINE()
|
||||
#endif
|
||||
static DWORD orig_cp = 0;
|
||||
#endif
|
||||
@@ -1160,6 +1160,10 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
#if defined(PHP_WIN32)
|
||||
+ if (!php_win32_ioutil_init()) {
|
||||
+ fprintf(stderr, "ioutil initialization failed");
|
||||
+ return 1;
|
||||
+ }
|
||||
# ifdef PHP_CLI_WIN32_NO_CONSOLE
|
||||
int argc = __argc;
|
||||
char **argv = __argv;
|
||||
23
src/globals/patch/php-src-patches/cli_static_84.patch
Normal file
23
src/globals/patch/php-src-patches/cli_static_84.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
|
||||
--- a/sapi/cli/php_cli.c (revision d3bf67d44102869f340a7be0e12f4f09de0edbcf)
|
||||
+++ b/sapi/cli/php_cli.c (date 1735128770216)
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
#if defined(PHP_WIN32)
|
||||
#if defined(ZTS)
|
||||
-ZEND_TSRMLS_CACHE_DEFINE()
|
||||
+//ZEND_TSRMLS_CACHE_DEFINE()
|
||||
#endif
|
||||
static DWORD orig_cp = 0;
|
||||
#endif
|
||||
@@ -1137,6 +1137,10 @@
|
||||
#endif
|
||||
{
|
||||
#if defined(PHP_WIN32)
|
||||
+ if (!php_win32_ioutil_init()) {
|
||||
+ fprintf(stderr, "ioutil initialization failed");
|
||||
+ return 1;
|
||||
+ }
|
||||
# ifdef PHP_CLI_WIN32_NO_CONSOLE
|
||||
int argc = __argc;
|
||||
char **argv = __argv;
|
||||
13
src/globals/patch/php-src-patches/cli_static_85.patch
Normal file
13
src/globals/patch/php-src-patches/cli_static_85.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
|
||||
index e212a0f7..f16e8ea9 100644
|
||||
--- a/sapi/cli/php_cli.c
|
||||
+++ b/sapi/cli/php_cli.c
|
||||
@@ -98,7 +98,7 @@ PHPAPI extern char *php_ini_scanned_files;
|
||||
|
||||
#if defined(PHP_WIN32)
|
||||
#if defined(ZTS)
|
||||
-ZEND_TSRMLS_CACHE_DEFINE()
|
||||
+// ZEND_TSRMLS_CACHE_DEFINE()
|
||||
#endif
|
||||
static DWORD orig_cp = 0;
|
||||
#endif
|
||||
21
src/globals/patch/php-src-patches/comctl32.patch
Normal file
21
src/globals/patch/php-src-patches/comctl32.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff --git a/win32/build/default.manifest b/win32/build/default.manifest
|
||||
index a73c2fb53d..52351251e1 100644
|
||||
--- a/win32/build/default.manifest
|
||||
+++ b/win32/build/default.manifest
|
||||
@@ -24,4 +24,16 @@
|
||||
<ws2:longPathAware>true</ws2:longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
+ <dependency>
|
||||
+ <dependentAssembly>
|
||||
+ <assemblyIdentity
|
||||
+ type="win32"
|
||||
+ name="Microsoft.Windows.Common-Controls"
|
||||
+ version="6.0.0.0"
|
||||
+ processorArchitecture="*"
|
||||
+ publicKeyToken="6595b64144ccf1df"
|
||||
+ language="*"
|
||||
+ />
|
||||
+ </dependentAssembly>
|
||||
+ </dependency>
|
||||
</assembly>
|
||||
11
src/globals/patch/php-src-patches/disable_huge_page_80.patch
Normal file
11
src/globals/patch/php-src-patches/disable_huge_page_80.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- php-8.0.0/configure.ac 2020-11-25 01:04:03.000000000 +0800
|
||||
+++ php-8.0.0-micro/configure.ac 2020-11-29 20:00:13.256181206 +0800
|
||||
@@ -1005,7 +1005,7 @@ dnl Extensions post-config.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
dnl Align segments on huge page boundary
|
||||
-case $host_alias in
|
||||
+case nope in
|
||||
i[[3456]]86-*-linux-* | x86_64-*-linux-*)
|
||||
AC_MSG_CHECKING(linker support for -zcommon-page-size=2097152)
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
13
src/globals/patch/php-src-patches/disable_huge_page_84.patch
Normal file
13
src/globals/patch/php-src-patches/disable_huge_page_84.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 48778c7bd2..760c4f2670 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1127,7 +1127,7 @@ dnl Extensions post-config.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
dnl Align segments on huge page boundary
|
||||
-AS_CASE([$host_alias], [[i[3456]86-*-linux-* | x86_64-*-linux-*]],
|
||||
+AS_CASE([nope], [[i[3456]86-*-linux-* | x86_64-*-linux-*]],
|
||||
[AC_CACHE_CHECK([linker support for -zcommon-page-size=2097152],
|
||||
[php_cv_have_common_page_size], [
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
23
src/globals/patch/php-src-patches/macos_iconv_80.patch
Normal file
23
src/globals/patch/php-src-patches/macos_iconv_80.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff --git a/build/php.m4 b/build/php.m4
|
||||
index 01b8250598..0a8c5fba53 100644
|
||||
--- a/build/php.m4
|
||||
+++ b/build/php.m4
|
||||
@@ -1963,9 +1963,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
|
||||
dnl Check libc first if no path is provided in --with-iconv.
|
||||
if test "$PHP_ICONV" = "yes"; then
|
||||
- dnl Reset LIBS temporarily as it may have already been included -liconv in.
|
||||
- LIBS_save="$LIBS"
|
||||
- LIBS=
|
||||
+ LIBS="$LIBS -liconv"
|
||||
AC_CHECK_FUNC(iconv, [
|
||||
found_iconv=yes
|
||||
],[
|
||||
@@ -1974,7 +1972,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
found_iconv=yes
|
||||
])
|
||||
])
|
||||
- LIBS="$LIBS_save"
|
||||
fi
|
||||
|
||||
dnl Check external libs for iconv funcs.
|
||||
23
src/globals/patch/php-src-patches/macos_iconv_81.patch
Normal file
23
src/globals/patch/php-src-patches/macos_iconv_81.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff --git a/build/php.m4 b/build/php.m4
|
||||
index 01b8250598..0a8c5fba53 100644
|
||||
--- a/build/php.m4
|
||||
+++ b/build/php.m4
|
||||
@@ -1963,9 +1963,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
|
||||
dnl Check libc first if no path is provided in --with-iconv.
|
||||
if test "$PHP_ICONV" = "yes"; then
|
||||
- dnl Reset LIBS temporarily as it may have already been included -liconv in.
|
||||
- LIBS_save="$LIBS"
|
||||
- LIBS=
|
||||
+ LIBS="$LIBS -liconv"
|
||||
AC_CHECK_FUNC(iconv, [
|
||||
found_iconv=yes
|
||||
],[
|
||||
@@ -1974,7 +1972,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
found_iconv=yes
|
||||
])
|
||||
])
|
||||
- LIBS="$LIBS_save"
|
||||
fi
|
||||
|
||||
dnl Check external libs for iconv funcs.
|
||||
23
src/globals/patch/php-src-patches/macos_iconv_82.patch
Normal file
23
src/globals/patch/php-src-patches/macos_iconv_82.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff --git a/build/php.m4 b/build/php.m4
|
||||
index 01b8250598..0a8c5fba53 100644
|
||||
--- a/build/php.m4
|
||||
+++ b/build/php.m4
|
||||
@@ -1963,9 +1963,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
|
||||
dnl Check libc first if no path is provided in --with-iconv.
|
||||
if test "$PHP_ICONV" = "yes"; then
|
||||
- dnl Reset LIBS temporarily as it may have already been included -liconv in.
|
||||
- LIBS_save="$LIBS"
|
||||
- LIBS=
|
||||
+ LIBS="$LIBS -liconv"
|
||||
AC_CHECK_FUNC(iconv, [
|
||||
found_iconv=yes
|
||||
],[
|
||||
@@ -1974,7 +1972,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
found_iconv=yes
|
||||
])
|
||||
])
|
||||
- LIBS="$LIBS_save"
|
||||
fi
|
||||
|
||||
dnl Check external libs for iconv funcs.
|
||||
23
src/globals/patch/php-src-patches/macos_iconv_83.patch
Normal file
23
src/globals/patch/php-src-patches/macos_iconv_83.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff --git a/build/php.m4 b/build/php.m4
|
||||
index 01b8250598..0a8c5fba53 100644
|
||||
--- a/build/php.m4
|
||||
+++ b/build/php.m4
|
||||
@@ -1963,9 +1963,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
|
||||
dnl Check libc first if no path is provided in --with-iconv.
|
||||
if test "$PHP_ICONV" = "yes"; then
|
||||
- dnl Reset LIBS temporarily as it may have already been included -liconv in.
|
||||
- LIBS_save="$LIBS"
|
||||
- LIBS=
|
||||
+ LIBS="$LIBS -liconv"
|
||||
AC_CHECK_FUNC(iconv, [
|
||||
found_iconv=yes
|
||||
],[
|
||||
@@ -1974,7 +1972,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
found_iconv=yes
|
||||
])
|
||||
])
|
||||
- LIBS="$LIBS_save"
|
||||
fi
|
||||
|
||||
dnl Check external libs for iconv funcs.
|
||||
21
src/globals/patch/php-src-patches/macos_iconv_84.patch
Normal file
21
src/globals/patch/php-src-patches/macos_iconv_84.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff --git a/build/php.m4 b/build/php.m4
|
||||
index e45b22b766..506be904f1 100644
|
||||
--- a/build/php.m4
|
||||
+++ b/build/php.m4
|
||||
@@ -1821,15 +1821,12 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
|
||||
dnl Check libc first if no path is provided in --with-iconv.
|
||||
AS_VAR_IF([PHP_ICONV], [yes], [
|
||||
- dnl Reset LIBS temporarily as it may have already been included -liconv in.
|
||||
- LIBS_save=$LIBS
|
||||
- LIBS=
|
||||
+ LIBS="$LIBS -liconv"
|
||||
AC_CHECK_FUNC([iconv], [found_iconv=yes],
|
||||
[AC_CHECK_FUNC([libiconv], [
|
||||
AC_DEFINE([HAVE_LIBICONV], [1])
|
||||
found_iconv=yes
|
||||
])])
|
||||
- LIBS=$LIBS_save
|
||||
])
|
||||
|
||||
dnl Check external libs for iconv funcs.
|
||||
22
src/globals/patch/php-src-patches/phar_80.patch
Normal file
22
src/globals/patch/php-src-patches/phar_80.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
|
||||
index 2403d77a..c908a1b4 100644
|
||||
--- a/ext/phar/phar.c
|
||||
+++ b/ext/phar/phar.c
|
||||
@@ -3309,6 +3309,8 @@ static zend_string *phar_resolve_path(const char *filename, size_t filename_len)
|
||||
return phar_find_in_include_path((char *) filename, filename_len, NULL);
|
||||
}
|
||||
|
||||
+char *micro_get_filename(void);
|
||||
+
|
||||
static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type) /* {{{ */
|
||||
{
|
||||
zend_op_array *res;
|
||||
@@ -3319,7 +3321,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type)
|
||||
if (!file_handle || !file_handle->filename) {
|
||||
return phar_orig_compile_file(file_handle, type);
|
||||
}
|
||||
- if (strstr(file_handle->filename, ".phar") && !strstr(file_handle->filename, "://")) {
|
||||
+ if ((strstr(file_handle->filename, micro_get_filename()) || strstr(file_handle->filename, ".phar")) && !strstr(file_handle->filename, "://")) {
|
||||
if (SUCCESS == phar_open_from_filename((char*)file_handle->filename, strlen(file_handle->filename), NULL, 0, 0, &phar, NULL)) {
|
||||
if (phar->is_zip || phar->is_tar) {
|
||||
zend_file_handle f = *file_handle;
|
||||
22
src/globals/patch/php-src-patches/phar_81.patch
Normal file
22
src/globals/patch/php-src-patches/phar_81.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
|
||||
index 3c0f3eb50b..455b303a8d 100644
|
||||
--- a/ext/phar/phar.c
|
||||
+++ b/ext/phar/phar.c
|
||||
@@ -3295,6 +3295,8 @@ static zend_string *phar_resolve_path(zend_string *filename)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+char *micro_get_filename(void);
|
||||
+
|
||||
static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type) /* {{{ */
|
||||
{
|
||||
zend_op_array *res;
|
||||
@@ -3305,7 +3307,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type)
|
||||
if (!file_handle || !file_handle->filename) {
|
||||
return phar_orig_compile_file(file_handle, type);
|
||||
}
|
||||
- if (strstr(ZSTR_VAL(file_handle->filename), ".phar") && !strstr(ZSTR_VAL(file_handle->filename), "://")) {
|
||||
+ if ((strstr(ZSTR_VAL(file_handle->filename), micro_get_filename()) || strstr(ZSTR_VAL(file_handle->filename), ".phar")) && !strstr(ZSTR_VAL(file_handle->filename), "://")) {
|
||||
if (SUCCESS == phar_open_from_filename(ZSTR_VAL(file_handle->filename), ZSTR_LEN(file_handle->filename), NULL, 0, 0, &phar, NULL)) {
|
||||
if (phar->is_zip || phar->is_tar) {
|
||||
zend_file_handle f;
|
||||
@@ -0,0 +1,31 @@
|
||||
diff --git a/ext/fileinfo/config.w32 b/ext/fileinfo/config.w32
|
||||
index eefccb3d72..b231f67b23 100644
|
||||
--- a/ext/fileinfo/config.w32
|
||||
+++ b/ext/fileinfo/config.w32
|
||||
@@ -10,6 +10,6 @@ if (PHP_FILEINFO != 'no') {
|
||||
readcdf.c softmagic.c der.c \
|
||||
strcasestr.c buffer.c is_csv.c";
|
||||
|
||||
- EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
+ EXTENSION('fileinfo', 'fileinfo.c', PHP_FILEINFO_SHARED, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
|
||||
}
|
||||
diff --git a/ext/openssl/config.w32 b/ext/openssl/config.w32
|
||||
index 9187d6bfc2..f1acc2e8b5 100644
|
||||
--- a/ext/openssl/config.w32
|
||||
+++ b/ext/openssl/config.w32
|
||||
@@ -1,12 +1,12 @@
|
||||
// vim:ft=javascript
|
||||
|
||||
-ARG_WITH("openssl", "OpenSSL support", "no,shared");
|
||||
+ARG_WITH("openssl", "OpenSSL support", "no");
|
||||
|
||||
if (PHP_OPENSSL != "no") {
|
||||
var ret = SETUP_OPENSSL("openssl", PHP_OPENSSL);
|
||||
|
||||
if (ret > 0) {
|
||||
- EXTENSION("openssl", "openssl.c xp_ssl.c");
|
||||
+ EXTENSION("openssl", "openssl.c xp_ssl.c", PHP_OPENSSL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
AC_DEFINE("HAVE_OPENSSL_EXT", PHP_OPENSSL_SHARED ? 0 : 1, "Have openssl");
|
||||
AC_DEFINE("HAVE_OPENSSL", 1);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diff --git a/ext/fileinfo/config.w32 b/ext/fileinfo/config.w32
|
||||
index e42f1ce3f7..db28a68676 100644
|
||||
--- a/ext/fileinfo/config.w32
|
||||
+++ b/ext/fileinfo/config.w32
|
||||
@@ -10,6 +10,6 @@ if (PHP_FILEINFO != 'no') {
|
||||
readcdf.c softmagic.c der.c \
|
||||
strcasestr.c buffer.c is_csv.c";
|
||||
|
||||
- EXTENSION('fileinfo', 'fileinfo.c php_libmagic.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
+ EXTENSION('fileinfo', 'fileinfo.c php_libmagic.c', PHP_FILEINFO_SHARED, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
|
||||
}
|
||||
diff --git a/ext/openssl/config.w32 b/ext/openssl/config.w32
|
||||
index 9187d6bfc2..f1acc2e8b5 100644
|
||||
--- a/ext/openssl/config.w32
|
||||
+++ b/ext/openssl/config.w32
|
||||
@@ -1,12 +1,12 @@
|
||||
// vim:ft=javascript
|
||||
|
||||
-ARG_WITH("openssl", "OpenSSL support", "no,shared");
|
||||
+ARG_WITH("openssl", "OpenSSL support", "no");
|
||||
|
||||
if (PHP_OPENSSL != "no") {
|
||||
var ret = SETUP_OPENSSL("openssl", PHP_OPENSSL);
|
||||
|
||||
if (ret > 0) {
|
||||
- EXTENSION("openssl", "openssl.c xp_ssl.c");
|
||||
+ EXTENSION("openssl", "openssl.c xp_ssl.c", PHP_OPENSSL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
AC_DEFINE("HAVE_OPENSSL_EXT", PHP_OPENSSL_SHARED ? 0 : 1, "Have openssl");
|
||||
AC_DEFINE("HAVE_OPENSSL", 1);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
diff --git a/ext/fileinfo/config.w32 b/ext/fileinfo/config.w32
|
||||
index 2a42dc45..c207694f 100644
|
||||
--- a/ext/fileinfo/config.w32
|
||||
+++ b/ext/fileinfo/config.w32
|
||||
@@ -10,7 +10,7 @@ if (PHP_FILEINFO != 'no') {
|
||||
readcdf.c softmagic.c der.c \
|
||||
strcasestr.c buffer.c is_csv.c";
|
||||
|
||||
- EXTENSION('fileinfo', 'fileinfo.c php_libmagic.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
+ EXTENSION('fileinfo', 'fileinfo.c php_libmagic.c', PHP_FILEINFO_SHARED, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
ADD_EXTENSION_DEP('fileinfo', 'pcre');
|
||||
ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
|
||||
}
|
||||
diff --git a/ext/openssl/config.w32 b/ext/openssl/config.w32
|
||||
index 24064ec2..87ff3161 100644
|
||||
--- a/ext/openssl/config.w32
|
||||
+++ b/ext/openssl/config.w32
|
||||
@@ -1,6 +1,6 @@
|
||||
// vim:ft=javascript
|
||||
|
||||
-ARG_WITH("openssl", "OpenSSL support", "no,shared");
|
||||
+ARG_WITH("openssl", "OpenSSL support", "no");
|
||||
|
||||
ARG_WITH("openssl-legacy-provider", "OPENSSL: Load legacy algorithm provider in addition to default provider", "no");
|
||||
|
||||
@@ -10,7 +10,7 @@ if (PHP_OPENSSL != "no") {
|
||||
var ret = SETUP_OPENSSL("openssl", PHP_OPENSSL);
|
||||
|
||||
if (ret >= 2) {
|
||||
- EXTENSION("openssl", "openssl.c openssl_pwhash.c xp_ssl.c");
|
||||
+ EXTENSION("openssl", "openssl.c openssl_pwhash.c xp_ssl.c", PHP_OPENSSL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
AC_DEFINE("HAVE_OPENSSL_EXT", 1, "Define to 1 if the PHP extension 'openssl' is available.");
|
||||
if (PHP_OPENSSL_LEGACY_PROVIDER != "no") {
|
||||
AC_DEFINE("LOAD_OPENSSL_LEGACY_PROVIDER", 1, "Define to 1 to load the OpenSSL legacy algorithm provider in addition to the default provider.");
|
||||
@@ -0,0 +1,34 @@
|
||||
diff --git a/ext/fileinfo/config.w32 b/ext/fileinfo/config.w32
|
||||
index 2a42dc45..c207694f 100644
|
||||
--- a/ext/fileinfo/config.w32
|
||||
+++ b/ext/fileinfo/config.w32
|
||||
@@ -10,7 +10,7 @@ if (PHP_FILEINFO != 'no') {
|
||||
readcdf.c softmagic.c der.c \
|
||||
strcasestr.c buffer.c is_csv.c";
|
||||
|
||||
- EXTENSION('fileinfo', 'fileinfo.c php_libmagic.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
+ EXTENSION('fileinfo', 'fileinfo.c php_libmagic.c', PHP_FILEINFO_SHARED, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
ADD_EXTENSION_DEP('fileinfo', 'pcre');
|
||||
ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
|
||||
}
|
||||
diff --git a/ext/openssl/config.w32 b/ext/openssl/config.w32
|
||||
index 714f93a0..0ab6efff 100644
|
||||
--- a/ext/openssl/config.w32
|
||||
+++ b/ext/openssl/config.w32
|
||||
@@ -1,6 +1,6 @@
|
||||
// vim:ft=javascript
|
||||
|
||||
-ARG_WITH("openssl", "OpenSSL support", "no,shared");
|
||||
+ARG_WITH("openssl", "OpenSSL support", "no");
|
||||
|
||||
ARG_WITH("openssl-legacy-provider", "OPENSSL: Load legacy algorithm provider in addition to default provider", "no");
|
||||
|
||||
@@ -10,7 +10,7 @@ if (PHP_OPENSSL != "no") {
|
||||
var ret = SETUP_OPENSSL("openssl", PHP_OPENSSL);
|
||||
|
||||
if (ret >= 2) {
|
||||
- EXTENSION("openssl", "openssl.c openssl_pwhash.c openssl_backend_common.c openssl_backend_v1.c openssl_backend_v3.c xp_ssl.c");
|
||||
+ EXTENSION("openssl", "openssl.c openssl_pwhash.c openssl_backend_common.c openssl_backend_v1.c openssl_backend_v3.c xp_ssl.c", PHP_OPENSSL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
AC_DEFINE("HAVE_OPENSSL_EXT", 1, "Define to 1 if the PHP extension 'openssl' is available.");
|
||||
if (PHP_OPENSSL_LEGACY_PROVIDER != "no") {
|
||||
AC_DEFINE("LOAD_OPENSSL_LEGACY_PROVIDER", 1, "Define to 1 to load the OpenSSL legacy algorithm provider in addition to the default provider.");
|
||||
129
src/globals/patch/php-src-patches/static_opcache_80.patch
Normal file
129
src/globals/patch/php-src-patches/static_opcache_80.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
|
||||
index ad3781101b..b7133fc0c8 100644
|
||||
--- a/build/order_by_dep.awk
|
||||
+++ b/build/order_by_dep.awk
|
||||
@@ -37,6 +37,11 @@ function get_module_index(name, i)
|
||||
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
|
||||
{
|
||||
module_name = mods[mod_idx];
|
||||
+ # TODO: real skip zend extension
|
||||
+ if (module_name == "opcache") {
|
||||
+ delete mods[mod_idx];
|
||||
+ return;
|
||||
+ }
|
||||
mod_name_len = length(module_name);
|
||||
|
||||
for (ext in mod_deps) {
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index c195ad7d2c..8bb8dd78fc 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -91,7 +91,10 @@ typedef int gid_t;
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
+// avoid symbol conflict
|
||||
ZEND_EXTENSION();
|
||||
+#endif
|
||||
|
||||
#ifndef ZTS
|
||||
zend_accel_globals accel_globals;
|
||||
@@ -4991,7 +4994,11 @@ static int accel_finish_startup(void)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
||||
+#else
|
||||
+zend_extension opcache_zend_extension_entry = {
|
||||
+#endif
|
||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
||||
PHP_VERSION, /* version */
|
||||
"Zend Technologies", /* author */
|
||||
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
||||
index 5492fd920c..6fdb475e49 100644
|
||||
--- a/ext/opcache/config.m4
|
||||
+++ b/ext/opcache/config.m4
|
||||
@@ -21,7 +21,8 @@ PHP_ARG_ENABLE([opcache-jit],
|
||||
if test "$PHP_OPCACHE" != "no"; then
|
||||
|
||||
dnl Always build as shared extension
|
||||
- ext_shared=yes
|
||||
+ dnl why?
|
||||
+ dnl ext_shared=yes
|
||||
|
||||
if test "$PHP_HUGE_CODE_PAGES" = "yes"; then
|
||||
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
|
||||
@@ -334,7 +335,9 @@ int main() {
|
||||
Optimizer/compact_vars.c \
|
||||
Optimizer/zend_dump.c \
|
||||
$ZEND_JIT_SRC,
|
||||
- shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes)
|
||||
+ $ext_shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes)
|
||||
+
|
||||
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
|
||||
|
||||
PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1)
|
||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
||||
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
|
||||
index fb921c73da..41de817bda 100644
|
||||
--- a/ext/opcache/config.w32
|
||||
+++ b/ext/opcache/config.w32
|
||||
@@ -16,7 +16,9 @@ if (PHP_OPCACHE != "no") {
|
||||
zend_persist_calc.c \
|
||||
zend_file_cache.c \
|
||||
zend_shared_alloc.c \
|
||||
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+
|
||||
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
|
||||
|
||||
if (PHP_OPCACHE_JIT == "yes") {
|
||||
if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index a40a4c8c37..ae93c8ae6c 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -2016,6 +2016,18 @@ void dummy_invalid_parameter_handler(
|
||||
}
|
||||
#endif
|
||||
|
||||
+// this can be moved to other place
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+extern zend_extension opcache_zend_extension_entry;
|
||||
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
|
||||
+
|
||||
+int zend_load_static_extensions(void)
|
||||
+{
|
||||
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* {{{ php_module_startup */
|
||||
int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint32_t num_additional_modules)
|
||||
{
|
||||
@@ -2255,6 +2267,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
||||
ahead of all other internals
|
||||
*/
|
||||
php_ini_register_extensions();
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+ zend_load_static_extensions();
|
||||
+#endif
|
||||
zend_startup_modules();
|
||||
|
||||
/* start Zend extensions */
|
||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
||||
index bf88cdae44..f8f6547e39 100644
|
||||
--- a/win32/build/confutils.js
|
||||
+++ b/win32/build/confutils.js
|
||||
@@ -1535,6 +1535,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
||||
}
|
||||
}
|
||||
|
||||
+ // TODO: real skip zend extensions
|
||||
+ if (extname != 'opcache')
|
||||
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
|
||||
|
||||
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
|
||||
129
src/globals/patch/php-src-patches/static_opcache_81.patch
Normal file
129
src/globals/patch/php-src-patches/static_opcache_81.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
|
||||
index 1e71ea2069..3da32d8830 100644
|
||||
--- a/build/order_by_dep.awk
|
||||
+++ b/build/order_by_dep.awk
|
||||
@@ -37,6 +37,11 @@ function get_module_index(name, i)
|
||||
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
|
||||
{
|
||||
module_name = mods[mod_idx];
|
||||
+ # TODO: real skip zend extension
|
||||
+ if (module_name == "opcache") {
|
||||
+ delete mods[mod_idx];
|
||||
+ return;
|
||||
+ }
|
||||
mod_name_len = length(module_name);
|
||||
|
||||
for (ext in mod_deps) {
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index 5f6b854d47..ea15c0d5bc 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -91,7 +91,10 @@ typedef int gid_t;
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
+// avoid symbol conflict
|
||||
ZEND_EXTENSION();
|
||||
+#endif
|
||||
|
||||
#ifndef ZTS
|
||||
zend_accel_globals accel_globals;
|
||||
@@ -4808,7 +4811,11 @@ static int accel_finish_startup(void)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
||||
+#else
|
||||
+zend_extension opcache_zend_extension_entry = {
|
||||
+#endif
|
||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
||||
PHP_VERSION, /* version */
|
||||
"Zend Technologies", /* author */
|
||||
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
||||
index 2a83fa2455..7b3b37182e 100644
|
||||
--- a/ext/opcache/config.m4
|
||||
+++ b/ext/opcache/config.m4
|
||||
@@ -21,7 +21,8 @@ PHP_ARG_ENABLE([opcache-jit],
|
||||
if test "$PHP_OPCACHE" != "no"; then
|
||||
|
||||
dnl Always build as shared extension
|
||||
- ext_shared=yes
|
||||
+ dnl why?
|
||||
+ dnl ext_shared=yes
|
||||
|
||||
if test "$PHP_HUGE_CODE_PAGES" = "yes"; then
|
||||
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
|
||||
@@ -327,7 +328,9 @@ int main() {
|
||||
shared_alloc_mmap.c \
|
||||
shared_alloc_posix.c \
|
||||
$ZEND_JIT_SRC,
|
||||
- shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
||||
+ $ext_shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
||||
+
|
||||
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
|
||||
|
||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
||||
|
||||
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
|
||||
index 764a2edaab..95427090ce 100644
|
||||
--- a/ext/opcache/config.w32
|
||||
+++ b/ext/opcache/config.w32
|
||||
@@ -16,7 +16,9 @@ if (PHP_OPCACHE != "no") {
|
||||
zend_persist_calc.c \
|
||||
zend_file_cache.c \
|
||||
zend_shared_alloc.c \
|
||||
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+
|
||||
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
|
||||
|
||||
if (PHP_OPCACHE_JIT == "yes") {
|
||||
if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index 8c16f01b11..0560348a06 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -2011,6 +2011,18 @@ void dummy_invalid_parameter_handler(
|
||||
}
|
||||
#endif
|
||||
|
||||
+// this can be moved to other place
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+extern zend_extension opcache_zend_extension_entry;
|
||||
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
|
||||
+
|
||||
+int zend_load_static_extensions(void)
|
||||
+{
|
||||
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* {{{ php_module_startup */
|
||||
int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint32_t num_additional_modules)
|
||||
{
|
||||
@@ -2253,6 +2265,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
||||
ahead of all other internals
|
||||
*/
|
||||
php_ini_register_extensions();
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+ zend_load_static_extensions();
|
||||
+#endif
|
||||
zend_startup_modules();
|
||||
|
||||
/* start Zend extensions */
|
||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
||||
index 1a2dfe43b4..ae405f035a 100644
|
||||
--- a/win32/build/confutils.js
|
||||
+++ b/win32/build/confutils.js
|
||||
@@ -1535,6 +1535,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
||||
}
|
||||
}
|
||||
|
||||
+ // TODO: real skip zend extensions
|
||||
+ if (extname != 'opcache')
|
||||
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
|
||||
|
||||
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
|
||||
129
src/globals/patch/php-src-patches/static_opcache_82.patch
Normal file
129
src/globals/patch/php-src-patches/static_opcache_82.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
|
||||
index 1e71ea20..77895167 100644
|
||||
--- a/build/order_by_dep.awk
|
||||
+++ b/build/order_by_dep.awk
|
||||
@@ -37,6 +37,11 @@ function get_module_index(name, i)
|
||||
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
|
||||
{
|
||||
module_name = mods[mod_idx];
|
||||
+ # TODO: real skip zend extension
|
||||
+ if (module_name == "opcache") {
|
||||
+ delete mods[mod_idx];
|
||||
+ return;
|
||||
+ }
|
||||
mod_name_len = length(module_name);
|
||||
|
||||
for (ext in mod_deps) {
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index 9bcd035c..7bc01614 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -93,7 +93,10 @@ typedef int gid_t;
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
+// avoid symbol conflict
|
||||
ZEND_EXTENSION();
|
||||
+#endif
|
||||
|
||||
#ifndef ZTS
|
||||
zend_accel_globals accel_globals;
|
||||
@@ -4792,7 +4795,11 @@ static int accel_finish_startup(void)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
||||
+#else
|
||||
+zend_extension opcache_zend_extension_entry = {
|
||||
+#endif
|
||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
||||
PHP_VERSION, /* version */
|
||||
"Zend Technologies", /* author */
|
||||
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
||||
index b3929382..8607ff25 100644
|
||||
--- a/ext/opcache/config.m4
|
||||
+++ b/ext/opcache/config.m4
|
||||
@@ -21,7 +21,8 @@ PHP_ARG_ENABLE([opcache-jit],
|
||||
if test "$PHP_OPCACHE" != "no"; then
|
||||
|
||||
dnl Always build as shared extension
|
||||
- ext_shared=yes
|
||||
+ dnl why?
|
||||
+ dnl ext_shared=yes
|
||||
|
||||
if test "$PHP_HUGE_CODE_PAGES" = "yes"; then
|
||||
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
|
||||
@@ -336,7 +337,9 @@ int main(void) {
|
||||
shared_alloc_mmap.c \
|
||||
shared_alloc_posix.c \
|
||||
$ZEND_JIT_SRC,
|
||||
- shared,,"$PHP_OPCACHE_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
||||
+ $ext_shared,,"$PHP_OPCACHE_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
||||
+
|
||||
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
|
||||
|
||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
||||
|
||||
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
|
||||
index 764a2eda..95427090 100644
|
||||
--- a/ext/opcache/config.w32
|
||||
+++ b/ext/opcache/config.w32
|
||||
@@ -16,7 +16,9 @@ if (PHP_OPCACHE != "no") {
|
||||
zend_persist_calc.c \
|
||||
zend_file_cache.c \
|
||||
zend_shared_alloc.c \
|
||||
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+
|
||||
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
|
||||
|
||||
if (PHP_OPCACHE_JIT == "yes") {
|
||||
if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index 0adecd10..ee89ebfb 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -2048,6 +2048,18 @@ void dummy_invalid_parameter_handler(
|
||||
}
|
||||
#endif
|
||||
|
||||
+// this can be moved to other place
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+extern zend_extension opcache_zend_extension_entry;
|
||||
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
|
||||
+
|
||||
+int zend_load_static_extensions(void)
|
||||
+{
|
||||
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* {{{ php_module_startup */
|
||||
zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_module)
|
||||
{
|
||||
@@ -2293,6 +2305,9 @@ zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additi
|
||||
ahead of all other internals
|
||||
*/
|
||||
php_ini_register_extensions();
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+ zend_load_static_extensions();
|
||||
+#endif
|
||||
zend_startup_modules();
|
||||
|
||||
/* start Zend extensions */
|
||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
||||
index 4eece379..59b7bd5c 100644
|
||||
--- a/win32/build/confutils.js
|
||||
+++ b/win32/build/confutils.js
|
||||
@@ -1534,6 +1534,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
||||
}
|
||||
}
|
||||
|
||||
+ // TODO: real skip zend extensions
|
||||
+ if (extname != 'opcache')
|
||||
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
|
||||
|
||||
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
|
||||
130
src/globals/patch/php-src-patches/static_opcache_83.patch
Normal file
130
src/globals/patch/php-src-patches/static_opcache_83.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
|
||||
index 1e71ea2069..3da32d8830 100644
|
||||
--- a/build/order_by_dep.awk
|
||||
+++ b/build/order_by_dep.awk
|
||||
@@ -37,6 +37,11 @@ function get_module_index(name, i)
|
||||
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
|
||||
{
|
||||
module_name = mods[mod_idx];
|
||||
+ # TODO: real skip zend extension
|
||||
+ if (module_name == "opcache") {
|
||||
+ delete mods[mod_idx];
|
||||
+ return;
|
||||
+ }
|
||||
mod_name_len = length(module_name);
|
||||
|
||||
for (ext in mod_deps) {
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index ec33c69eb2..b8ce7e3eca 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -93,7 +93,10 @@ typedef int gid_t;
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
+// avoid symbol conflict
|
||||
ZEND_EXTENSION();
|
||||
+#endif
|
||||
|
||||
#ifndef ZTS
|
||||
zend_accel_globals accel_globals;
|
||||
@@ -4814,7 +4817,11 @@ static int accel_finish_startup(void)
|
||||
#endif /* ZEND_WIN32 */
|
||||
}
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
||||
+#else
|
||||
+zend_extension opcache_zend_extension_entry = {
|
||||
+#endif
|
||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
||||
PHP_VERSION, /* version */
|
||||
"Zend Technologies", /* author */
|
||||
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
||||
index 2a83fa2455..7b3b37182e 100644
|
||||
--- a/ext/opcache/config.m4
|
||||
+++ b/ext/opcache/config.m4
|
||||
@@ -27,7 +27,8 @@
|
||||
if test "$PHP_OPCACHE" != "no"; then
|
||||
|
||||
dnl Always build as shared extension
|
||||
- ext_shared=yes
|
||||
+ dnl why?
|
||||
+ dnl ext_shared=yes
|
||||
|
||||
if test "$PHP_HUGE_CODE_PAGES" = "yes"; then
|
||||
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
|
||||
@@ -319,8 +320,10 @@
|
||||
shared_alloc_mmap.c \
|
||||
shared_alloc_posix.c \
|
||||
$ZEND_JIT_SRC,
|
||||
- shared,,"$PHP_OPCACHE_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
||||
+ $ext_shared,,"$PHP_OPCACHE_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
||||
|
||||
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
|
||||
+
|
||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
||||
|
||||
if test "$have_shm_ipc" != "yes" && test "$have_shm_mmap_posix" != "yes" && test "$have_shm_mmap_anon" != "yes"; then
|
||||
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
|
||||
index 764a2edaab..95427090ce 100644
|
||||
--- a/ext/opcache/config.w32
|
||||
+++ b/ext/opcache/config.w32
|
||||
@@ -16,7 +16,9 @@ if (PHP_OPCACHE != "no") {
|
||||
zend_persist_calc.c \
|
||||
zend_file_cache.c \
|
||||
zend_shared_alloc.c \
|
||||
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+
|
||||
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
|
||||
|
||||
if (PHP_OPCACHE_JIT == "yes") {
|
||||
if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index 6fdfbce13e..bcccfad6e3 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -2012,6 +2012,18 @@ void dummy_invalid_parameter_handler(
|
||||
}
|
||||
#endif
|
||||
|
||||
+// this can be moved to other place
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+extern zend_extension opcache_zend_extension_entry;
|
||||
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
|
||||
+
|
||||
+int zend_load_static_extensions(void)
|
||||
+{
|
||||
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* {{{ php_module_startup */
|
||||
zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_module)
|
||||
{
|
||||
@@ -2196,6 +2208,9 @@ zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additi
|
||||
ahead of all other internals
|
||||
*/
|
||||
php_ini_register_extensions();
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+ zend_load_static_extensions();
|
||||
+#endif
|
||||
zend_startup_modules();
|
||||
|
||||
/* start Zend extensions */
|
||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
||||
index 359c751b7b..01068efcf6 100644
|
||||
--- a/win32/build/confutils.js
|
||||
+++ b/win32/build/confutils.js
|
||||
@@ -1534,6 +1534,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
||||
}
|
||||
}
|
||||
|
||||
+ // TODO: real skip zend extensions
|
||||
+ if (extname != 'opcache')
|
||||
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
|
||||
|
||||
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
|
||||
146
src/globals/patch/php-src-patches/static_opcache_84.patch
Normal file
146
src/globals/patch/php-src-patches/static_opcache_84.patch
Normal file
@@ -0,0 +1,146 @@
|
||||
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
|
||||
index 1e71ea20..3da32d88 100644
|
||||
--- a/build/order_by_dep.awk
|
||||
+++ b/build/order_by_dep.awk
|
||||
@@ -37,6 +37,11 @@ function get_module_index(name, i)
|
||||
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
|
||||
{
|
||||
module_name = mods[mod_idx];
|
||||
+ # TODO: real skip zend extension
|
||||
+ if (module_name == "opcache") {
|
||||
+ delete mods[mod_idx];
|
||||
+ return;
|
||||
+ }
|
||||
mod_name_len = length(module_name);
|
||||
|
||||
for (ext in mod_deps) {
|
||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
||||
index 3e8bdea9..4a784945 100644
|
||||
--- a/ext/opcache/ZendAccelerator.c
|
||||
+++ b/ext/opcache/ZendAccelerator.c
|
||||
@@ -97,7 +97,10 @@ typedef int gid_t;
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
+// micro: avoid symbol conflict
|
||||
ZEND_EXTENSION();
|
||||
+#endif
|
||||
|
||||
#ifndef ZTS
|
||||
zend_accel_globals accel_globals;
|
||||
@@ -4828,7 +4831,11 @@ static zend_result accel_finish_startup(void)
|
||||
#endif /* ZEND_WIN32 */
|
||||
}
|
||||
|
||||
+#ifdef COMPILE_DL_OPCACHE
|
||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
||||
+#else
|
||||
+zend_extension opcache_zend_extension_entry = {
|
||||
+#endif
|
||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
||||
PHP_VERSION, /* version */
|
||||
"Zend Technologies", /* author */
|
||||
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
||||
index 8f6d5ab7..19530321 100644
|
||||
--- a/ext/opcache/config.m4
|
||||
+++ b/ext/opcache/config.m4
|
||||
@@ -26,8 +26,8 @@ PHP_ARG_WITH([capstone],
|
||||
[no])
|
||||
|
||||
if test "$PHP_OPCACHE" != "no"; then
|
||||
- dnl Always build as shared extension.
|
||||
- ext_shared=yes
|
||||
+ dnl Always build as shared extension. (micro patches: no, we need static)
|
||||
+ dnl ext_shared=yes
|
||||
|
||||
AS_VAR_IF([PHP_HUGE_CODE_PAGES], [yes],
|
||||
[AC_DEFINE([HAVE_HUGE_CODE_PAGES], [1],
|
||||
@@ -343,6 +343,7 @@ int main(void) {
|
||||
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $JIT_CFLAGS],,
|
||||
[yes])
|
||||
|
||||
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
|
||||
PHP_ADD_EXTENSION_DEP(opcache, date)
|
||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
||||
|
||||
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
|
||||
index d0af7258..a054e6c8 100644
|
||||
--- a/ext/opcache/config.w32
|
||||
+++ b/ext/opcache/config.w32
|
||||
@@ -16,8 +16,9 @@ if (PHP_OPCACHE != "no") {
|
||||
zend_persist_calc.c \
|
||||
zend_file_cache.c \
|
||||
zend_shared_alloc.c \
|
||||
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
|
||||
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
|
||||
ADD_EXTENSION_DEP('opcache', 'date');
|
||||
ADD_EXTENSION_DEP('opcache', 'hash');
|
||||
ADD_EXTENSION_DEP('opcache', 'pcre');
|
||||
diff --git a/ext/opcache/jit/ir/ir_gdb.c b/ext/opcache/jit/ir/ir_gdb.c
|
||||
index ecaf8803..a8275466 100644
|
||||
--- a/ext/opcache/jit/ir/ir_gdb.c
|
||||
+++ b/ext/opcache/jit/ir/ir_gdb.c
|
||||
@@ -504,11 +504,11 @@ typedef struct _ir_gdbjit_descriptor {
|
||||
extern ir_gdbjit_descriptor __jit_debug_descriptor;
|
||||
void __jit_debug_register_code(void);
|
||||
#else
|
||||
-ir_gdbjit_descriptor __jit_debug_descriptor = {
|
||||
+static ir_gdbjit_descriptor __jit_debug_descriptor = {
|
||||
1, IR_GDBJIT_NOACTION, NULL, NULL
|
||||
};
|
||||
|
||||
-IR_NEVER_INLINE void __jit_debug_register_code(void)
|
||||
+static IR_NEVER_INLINE void __jit_debug_register_code(void)
|
||||
{
|
||||
__asm__ __volatile__("");
|
||||
}
|
||||
diff --git a/main/main.c b/main/main.c
|
||||
index 0b38f303..b2cb9d4a 100644
|
||||
--- a/main/main.c
|
||||
+++ b/main/main.c
|
||||
@@ -2099,6 +2099,18 @@ void dummy_invalid_parameter_handler(
|
||||
}
|
||||
#endif
|
||||
|
||||
+// this can be moved to other place
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+extern zend_extension opcache_zend_extension_entry;
|
||||
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
|
||||
+
|
||||
+int zend_load_static_extensions(void)
|
||||
+{
|
||||
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* {{{ php_module_startup */
|
||||
zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_module)
|
||||
{
|
||||
@@ -2283,6 +2295,9 @@ zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additi
|
||||
ahead of all other internals
|
||||
*/
|
||||
php_ini_register_extensions();
|
||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
||||
+ zend_load_static_extensions();
|
||||
+#endif
|
||||
zend_startup_modules();
|
||||
|
||||
/* start Zend extensions */
|
||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
||||
index 1a4ddbff..f47090b7 100644
|
||||
--- a/win32/build/confutils.js
|
||||
+++ b/win32/build/confutils.js
|
||||
@@ -1531,7 +1531,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+ // micro: skip zend opcache
|
||||
+ if (extname != 'opcache')
|
||||
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
|
||||
|
||||
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
|
||||
12
src/globals/patch/php-src-patches/vcruntime140_74.patch
Normal file
12
src/globals/patch/php-src-patches/vcruntime140_74.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
--- a/main/main.c 2020-09-29 10:17:07.000000000 +0000
|
||||
+++ b/main/main.c 2020-11-19 07:57:40.769785000 +0000
|
||||
@@ -2172,7 +2172,8 @@ int php_module_startup(sapi_module_struc
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
-# if PHP_LINKER_MAJOR == 14
|
||||
+// fucked here
|
||||
+# if false && PHP_LINKER_MAJOR == 14
|
||||
/* Extend for other CRT if needed. */
|
||||
# if PHP_DEBUG
|
||||
# define PHP_VCRUNTIME "vcruntime140d.dll"
|
||||
11
src/globals/patch/php-src-patches/vcruntime140_80.patch
Normal file
11
src/globals/patch/php-src-patches/vcruntime140_80.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- php-8.0.0-src/win32/winutil.c 2020-11-24 17:04:03.000000000 +0000
|
||||
+++ php-8.0.0-micro/win32/winutil.c 2020-12-03 07:59:22.177745800 +0000
|
||||
@@ -484,7 +484,7 @@
|
||||
/* Expect a CRT module handle */
|
||||
PHP_WINUTIL_API BOOL php_win32_crt_compatible(char **err)
|
||||
{/*{{{*/
|
||||
-#if PHP_LINKER_MAJOR == 14
|
||||
+#if false && PHP_LINKER_MAJOR == 14
|
||||
/* Extend for other CRT if needed. */
|
||||
# if PHP_DEBUG
|
||||
const char *crt_name = "vcruntime140d.dll";
|
||||
21
src/globals/patch/php-src-patches/win32_74.patch
Normal file
21
src/globals/patch/php-src-patches/win32_74.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff -pru /mnt/c/Users/dixyes/Desktop/phiwrapaper/phibatsh/build/php-7.4.11-src/win32/build/confutils.js win32/build/confutils.js
|
||||
--- a/win32/build/confutils.js 2020-09-29 10:17:06.000000000 +0000
|
||||
+++ b/win32/build/confutils.js 2020-11-20 10:07:21.642064000 +0000
|
||||
@@ -3413,7 +3413,7 @@ function toolset_setup_common_libs()
|
||||
function toolset_setup_build_mode()
|
||||
{
|
||||
if (PHP_DEBUG == "yes") {
|
||||
- ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Od /D _DEBUG /D ZEND_DEBUG=1 " +
|
||||
+ ADD_FLAG("CFLAGS", "/LDd /MTd /W3 /Od /D _DEBUG /D ZEND_DEBUG=1 " +
|
||||
(X64?"/Zi":"/ZI"));
|
||||
ADD_FLAG("LDFLAGS", "/debug");
|
||||
// Avoid problems when linking to release libraries that use the release
|
||||
@@ -3425,7 +3425,7 @@ function toolset_setup_build_mode()
|
||||
ADD_FLAG("CFLAGS", "/Zi");
|
||||
ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
|
||||
}
|
||||
- ADD_FLAG("CFLAGS", "/LD /MD /W3");
|
||||
+ ADD_FLAG("CFLAGS", "/LD /MT /W3");
|
||||
if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) {
|
||||
ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0");
|
||||
} else {
|
||||
21
src/globals/patch/php-src-patches/win32_80.patch
Normal file
21
src/globals/patch/php-src-patches/win32_80.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff -urN php-8.0.0-src/win32/build/confutils.js php-8.0.0-micro/win32/build/confutils.js
|
||||
--- php-8.0.0-src/win32/build/confutils.js 2020-11-24 17:04:03.000000000 +0000
|
||||
+++ php-8.0.0-micro/win32/build/confutils.js 2020-12-03 06:16:12.949921700 +0000
|
||||
@@ -3407,7 +3407,7 @@
|
||||
function toolset_setup_build_mode()
|
||||
{
|
||||
if (PHP_DEBUG == "yes") {
|
||||
- ADD_FLAG("CFLAGS", "/LDd /MDd /Od /D _DEBUG /D ZEND_DEBUG=1 " +
|
||||
+ ADD_FLAG("CFLAGS", "/LDd /MTd /Od /D _DEBUG /D ZEND_DEBUG=1 " +
|
||||
(X64?"/Zi":"/ZI"));
|
||||
ADD_FLAG("LDFLAGS", "/debug");
|
||||
// Avoid problems when linking to release libraries that use the release
|
||||
@@ -3419,7 +3419,7 @@
|
||||
ADD_FLAG("CFLAGS", "/Zi");
|
||||
ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
|
||||
}
|
||||
- ADD_FLAG("CFLAGS", "/LD /MD");
|
||||
+ ADD_FLAG("CFLAGS", "/LD /MT");
|
||||
if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) {
|
||||
ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0");
|
||||
} else {
|
||||
22
src/globals/patch/php-src-patches/win32_82.patch
Normal file
22
src/globals/patch/php-src-patches/win32_82.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
||||
index dc6675c6d2..587d4022a6 100644
|
||||
--- a/win32/build/confutils.js
|
||||
+++ b/win32/build/confutils.js
|
||||
@@ -3454,7 +3454,7 @@ function toolset_setup_common_libs()
|
||||
function toolset_setup_build_mode()
|
||||
{
|
||||
if (PHP_DEBUG == "yes") {
|
||||
- ADD_FLAG("CFLAGS", "/LDd /MDd /Od /D _DEBUG /D ZEND_DEBUG=1 " +
|
||||
+ ADD_FLAG("CFLAGS", "/LDd /MTd /Od /D _DEBUG /D ZEND_DEBUG=1 " +
|
||||
(TARGET_ARCH == 'x86'?"/ZI":"/Zi"));
|
||||
ADD_FLAG("LDFLAGS", "/debug");
|
||||
// Avoid problems when linking to release libraries that use the release
|
||||
@@ -3466,7 +3466,7 @@ function toolset_setup_build_mode()
|
||||
ADD_FLAG("CFLAGS", "/Zi");
|
||||
ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
|
||||
}
|
||||
- ADD_FLAG("CFLAGS", "/LD /MD");
|
||||
+ ADD_FLAG("CFLAGS", "/LD /MT");
|
||||
if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) {
|
||||
ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0");
|
||||
} else {
|
||||
22
src/globals/patch/php-src-patches/win32_85.patch
Normal file
22
src/globals/patch/php-src-patches/win32_85.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
||||
index 0f97a1a2..4797967d 100644
|
||||
--- a/win32/build/confutils.js
|
||||
+++ b/win32/build/confutils.js
|
||||
@@ -3450,7 +3450,7 @@ function toolset_setup_common_libs()
|
||||
function toolset_setup_build_mode()
|
||||
{
|
||||
if (PHP_DEBUG == "yes") {
|
||||
- ADD_FLAG("CFLAGS", "/MDd /Od /U NDebug /U NDEBUG /D ZEND_DEBUG=1 " +
|
||||
+ ADD_FLAG("CFLAGS", "/MTd /Od /U NDebug /U NDEBUG /D ZEND_DEBUG=1 " +
|
||||
(TARGET_ARCH == 'x86'?"/ZI":"/Zi"));
|
||||
ADD_FLAG("LDFLAGS", "/debug");
|
||||
// Avoid problems when linking to release libraries that use the release
|
||||
@@ -3462,7 +3462,7 @@ function toolset_setup_build_mode()
|
||||
ADD_FLAG("CFLAGS", "/Zi");
|
||||
ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
|
||||
}
|
||||
- ADD_FLAG("CFLAGS", "/MD");
|
||||
+ ADD_FLAG("CFLAGS", "/MT");
|
||||
if (PHP_SANITIZER == "yes") {
|
||||
if (VS_TOOLSET) {
|
||||
ADD_FLAG("CFLAGS", "/Ox /U NDebug /U NDEBUG /D ZEND_DEBUG=1");
|
||||
88
src/globals/patch/php-src-patches/win32_api_80.patch
Normal file
88
src/globals/patch/php-src-patches/win32_api_80.patch
Normal file
@@ -0,0 +1,88 @@
|
||||
diff --git a/win32/dllmain.c b/win32/dllmain.c
|
||||
index a507f1e1..ab625bf3 100644
|
||||
--- a/win32/dllmain.c
|
||||
+++ b/win32/dllmain.c
|
||||
@@ -38,20 +38,6 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID dummy)
|
||||
switch (reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
- /*
|
||||
- * We do not need to check the return value of php_win32_init_gettimeofday()
|
||||
- * because the symbol bare minimum symbol we need is always available on our
|
||||
- * lowest supported platform.
|
||||
- *
|
||||
- * On Windows 8 or greater, we use a more precise symbol to obtain the system
|
||||
- * time, which is dynamically. The fallback allows us to proper support
|
||||
- * Vista/7/Server 2003 R2/Server 2008/Server 2008 R2.
|
||||
- *
|
||||
- * Instead simply initialize the global in win32/time.c for gettimeofday()
|
||||
- * use later on
|
||||
- */
|
||||
- php_win32_init_gettimeofday();
|
||||
-
|
||||
ret = ret && php_win32_ioutil_init();
|
||||
if (!ret) {
|
||||
fprintf(stderr, "ioutil initialization failed");
|
||||
diff --git a/win32/time.c b/win32/time.c
|
||||
index d1fe5145..57db914e 100644
|
||||
--- a/win32/time.c
|
||||
+++ b/win32/time.c
|
||||
@@ -23,42 +23,13 @@
|
||||
#include <errno.h>
|
||||
#include "php_win32_globals.h"
|
||||
|
||||
-typedef VOID (WINAPI *MyGetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime);
|
||||
-
|
||||
-static MyGetSystemTimeAsFileTime timefunc = NULL;
|
||||
-
|
||||
-#ifdef PHP_EXPORTS
|
||||
-static zend_always_inline MyGetSystemTimeAsFileTime get_time_func(void)
|
||||
-{/*{{{*/
|
||||
- MyGetSystemTimeAsFileTime timefunc = NULL;
|
||||
- HMODULE hMod = GetModuleHandle("kernel32.dll");
|
||||
-
|
||||
- if (hMod) {
|
||||
- /* Max possible resolution <1us, win8/server2012 */
|
||||
- timefunc = (MyGetSystemTimeAsFileTime)GetProcAddress(hMod, "GetSystemTimePreciseAsFileTime");
|
||||
- }
|
||||
-
|
||||
- if(!timefunc) {
|
||||
- /* 100ns blocks since 01-Jan-1641 */
|
||||
- timefunc = (MyGetSystemTimeAsFileTime) GetSystemTimeAsFileTime;
|
||||
- }
|
||||
-
|
||||
- return timefunc;
|
||||
-}/*}}}*/
|
||||
-
|
||||
-void php_win32_init_gettimeofday(void)
|
||||
-{/*{{{*/
|
||||
- timefunc = get_time_func();
|
||||
-}/*}}}*/
|
||||
-#endif
|
||||
-
|
||||
static zend_always_inline int getfilesystemtime(struct timeval *tv)
|
||||
{/*{{{*/
|
||||
FILETIME ft;
|
||||
unsigned __int64 ff = 0;
|
||||
ULARGE_INTEGER fft;
|
||||
|
||||
- timefunc(&ft);
|
||||
+ GetSystemTimePreciseAsFileTime(&ft);
|
||||
|
||||
/*
|
||||
* Do not cast a pointer to a FILETIME structure to either a
|
||||
diff --git a/win32/time.h b/win32/time.h
|
||||
index 51090ccf..77d1cbfd 100644
|
||||
--- a/win32/time.h
|
||||
+++ b/win32/time.h
|
||||
@@ -54,10 +54,4 @@ PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp );
|
||||
|
||||
PHPAPI int usleep(unsigned int useconds);
|
||||
|
||||
-#ifdef PHP_EXPORTS
|
||||
-/* This symbols are needed only for the DllMain, but should not be exported
|
||||
- or be available when used with PHP binaries. */
|
||||
-void php_win32_init_gettimeofday(void);
|
||||
-#endif
|
||||
-
|
||||
#endif
|
||||
12
src/globals/patch/php-src-patches/zend_stream.patch
Normal file
12
src/globals/patch/php-src-patches/zend_stream.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
--- php-8.0.0-src/Zend/zend_stream.c 2020-11-24 17:04:03.000000000 +0000
|
||||
+++ php-8.0.0-micro/Zend/zend_stream.c 2020-12-03 07:01:36.375355300 +0000
|
||||
@@ -23,7 +23,9 @@
|
||||
#include "zend_compile.h"
|
||||
#include "zend_stream.h"
|
||||
|
||||
+#if !defined(_CRT_INTERNAL_NONSTDC_NAMES) || !_CRT_INTERNAL_NONSTDC_NAMES
|
||||
ZEND_DLIMPORT int isatty(int fd);
|
||||
+#endif
|
||||
|
||||
static ssize_t zend_stream_stdio_reader(void *handle, char *buf, size_t len) /* {{{ */
|
||||
{
|
||||
Reference in New Issue
Block a user