|
| 1 | +diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c |
| 2 | +index 4c8fc9d1..8284ac2f 100644 |
| 3 | +--- a/TSRM/tsrm_win32.c |
| 4 | ++++ b/TSRM/tsrm_win32.c |
| 5 | +@@ -535,7 +535,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, |
| 6 | + } |
| 7 | + |
| 8 | + dwCreateFlags = NORMAL_PRIORITY_CLASS; |
| 9 | +- if (strcmp(sapi_module.name, "cli") != 0) { |
| 10 | ++ if (strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) { |
| 11 | + dwCreateFlags |= CREATE_NO_WINDOW; |
| 12 | + } |
| 13 | + |
| 14 | +diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c |
| 15 | +index 10fc11f5..eb4d4175 100644 |
| 16 | +--- a/ext/ffi/ffi.c |
| 17 | ++++ b/ext/ffi/ffi.c |
| 18 | +@@ -5478,7 +5478,7 @@ ZEND_MINIT_FUNCTION(ffi) |
| 19 | + { |
| 20 | + REGISTER_INI_ENTRIES(); |
| 21 | + |
| 22 | +- FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0; |
| 23 | ++ FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 1; |
| 24 | + |
| 25 | + zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error); |
| 26 | + |
| 27 | +diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c |
| 28 | +index f597df36..ec617af7 100644 |
| 29 | +--- a/ext/opcache/ZendAccelerator.c |
| 30 | ++++ b/ext/opcache/ZendAccelerator.c |
| 31 | +@@ -2847,6 +2847,7 @@ static void zps_startup_failure(const char *reason, const char *api_reason, int |
| 32 | + static inline bool accel_sapi_is_cli(void) |
| 33 | + { |
| 34 | + return strcmp(sapi_module.name, "cli") == 0 |
| 35 | ++ || strcmp(sapi_module.name, "micro") == 0 |
| 36 | + || strcmp(sapi_module.name, "phpdbg") == 0; |
| 37 | + } |
| 38 | + |
| 39 | +@@ -3163,6 +3164,7 @@ static int accel_startup(zend_extension *extension) |
| 40 | + #ifdef HAVE_HUGE_CODE_PAGES |
| 41 | + if (ZCG(accel_directives).huge_code_pages && |
| 42 | + (strcmp(sapi_module.name, "cli") == 0 || |
| 43 | ++ strcmp(sapi_module.name, "micro") == 0 || |
| 44 | + strcmp(sapi_module.name, "cli-server") == 0 || |
| 45 | + strcmp(sapi_module.name, "cgi-fcgi") == 0 || |
| 46 | + strcmp(sapi_module.name, "fpm-fcgi") == 0)) { |
| 47 | +@@ -4958,6 +4960,7 @@ static zend_result accel_finish_startup_preload_subprocess(pid_t *pid) |
| 48 | + || !*ZCG(accel_directives).preload_user) { |
| 49 | + |
| 50 | + bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0 |
| 51 | ++ || strcmp(sapi_module.name, "micro") == 0 |
| 52 | + || strcmp(sapi_module.name, "phpdbg") == 0); |
| 53 | + |
| 54 | + if (!sapi_requires_preload_user) { |
| 55 | +diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c |
| 56 | +index 023e35a2..6f00159a 100644 |
| 57 | +--- a/ext/pdo_sqlite/pdo_sqlite.c |
| 58 | ++++ b/ext/pdo_sqlite/pdo_sqlite.c |
| 59 | +@@ -94,6 +94,7 @@ PHP_METHOD(Pdo_Sqlite, loadExtension) |
| 60 | + #ifdef ZTS |
| 61 | + if ((strncmp(sapi_module.name, "cgi", 3) != 0) && |
| 62 | + (strcmp(sapi_module.name, "cli") != 0) && |
| 63 | ++ (strcmp(sapi_module.name, "micro") != 0) && |
| 64 | + (strncmp(sapi_module.name, "embed", 5) != 0) |
| 65 | + ) { |
| 66 | + zend_throw_exception_ex(php_pdo_get_exception(), 0, "Not supported in multithreaded Web servers"); |
| 67 | +diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c |
| 68 | +index 31212999..d7705d59 100644 |
| 69 | +--- a/ext/readline/readline_cli.c |
| 70 | ++++ b/ext/readline/readline_cli.c |
| 71 | +@@ -730,7 +730,7 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void); |
| 72 | + get_cli_shell_callbacks get_callbacks; \ |
| 73 | + HMODULE hMod = GetModuleHandle("php.exe"); \ |
| 74 | + (cb) = NULL; \ |
| 75 | +- if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) { \ |
| 76 | ++ if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3) || 0 == strcmp("micro", sapi_module.name)) { \ |
| 77 | + get_callbacks = (get_cli_shell_callbacks)GetProcAddress(hMod, "php_cli_get_shell_callbacks"); \ |
| 78 | + if (get_callbacks) { \ |
| 79 | + (cb) = get_callbacks(); \ |
| 80 | +diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c |
| 81 | +index 21b6840a..05a7aa8e 100644 |
| 82 | +--- a/ext/sqlite3/sqlite3.c |
| 83 | ++++ b/ext/sqlite3/sqlite3.c |
| 84 | +@@ -413,6 +413,7 @@ PHP_METHOD(SQLite3, loadExtension) |
| 85 | + #ifdef ZTS |
| 86 | + if ((strncmp(sapi_module.name, "cgi", 3) != 0) && |
| 87 | + (strcmp(sapi_module.name, "cli") != 0) && |
| 88 | ++ (strcmp(sapi_module.name, "micro") != 0) && |
| 89 | + (strncmp(sapi_module.name, "embed", 5) != 0) |
| 90 | + ) { php_sqlite3_error(db_obj, 0, "Not supported in multithreaded Web servers"); |
| 91 | + RETURN_FALSE; |
| 92 | +diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c |
| 93 | +index ea33ba49..083184b8 100644 |
| 94 | +--- a/ext/standard/php_fopen_wrapper.c |
| 95 | ++++ b/ext/standard/php_fopen_wrapper.c |
| 96 | +@@ -242,7 +242,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c |
| 97 | + } |
| 98 | + return NULL; |
| 99 | + } |
| 100 | +- if (!strcmp(sapi_module.name, "cli")) { |
| 101 | ++ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) { |
| 102 | + static int cli_in = 0; |
| 103 | + fd = STDIN_FILENO; |
| 104 | + if (cli_in) { |
| 105 | +@@ -258,7 +258,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c |
| 106 | + pipe_requested = 1; |
| 107 | + #endif |
| 108 | + } else if (!strcasecmp(path, "stdout")) { |
| 109 | +- if (!strcmp(sapi_module.name, "cli")) { |
| 110 | ++ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) { |
| 111 | + static int cli_out = 0; |
| 112 | + fd = STDOUT_FILENO; |
| 113 | + if (cli_out++) { |
| 114 | +@@ -274,7 +274,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c |
| 115 | + pipe_requested = 1; |
| 116 | + #endif |
| 117 | + } else if (!strcasecmp(path, "stderr")) { |
| 118 | +- if (!strcmp(sapi_module.name, "cli")) { |
| 119 | ++ if (!strcmp(sapi_module.name, "cli") && !strcmp(sapi_module.name, "micro")) { |
| 120 | + static int cli_err = 0; |
| 121 | + fd = STDERR_FILENO; |
| 122 | + if (cli_err++) { |
| 123 | +@@ -295,7 +295,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c |
| 124 | + zend_long fildes_ori; |
| 125 | + int dtablesize; |
| 126 | + |
| 127 | +- if (strcmp(sapi_module.name, "cli")) { |
| 128 | ++ if (strcmp(sapi_module.name, "cli") || strcmp(sapi_module.name, "micro")) { |
| 129 | + if (options & REPORT_ERRORS) { |
| 130 | + php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP"); |
| 131 | + } |
| 132 | +diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c |
| 133 | +index 690e23e0..80ab3d32 100644 |
| 134 | +--- a/ext/standard/proc_open.c |
| 135 | ++++ b/ext/standard/proc_open.c |
| 136 | +@@ -1333,7 +1333,7 @@ PHP_FUNCTION(proc_open) |
| 137 | + } |
| 138 | + |
| 139 | + dwCreateFlags = NORMAL_PRIORITY_CLASS; |
| 140 | +- if(strcmp(sapi_module.name, "cli") != 0) { |
| 141 | ++ if(strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) { |
| 142 | + dwCreateFlags |= CREATE_NO_WINDOW; |
| 143 | + } |
| 144 | + if (create_process_group) { |
| 145 | +diff --git a/main/main.c b/main/main.c |
| 146 | +index 8465b6c0..cf8f9ef0 100644 |
| 147 | +--- a/main/main.c |
| 148 | ++++ b/main/main.c |
| 149 | +@@ -580,7 +580,7 @@ static PHP_INI_DISP(display_errors_mode) |
| 150 | + mode = php_get_display_errors_mode(temporary_value); |
| 151 | + |
| 152 | + /* Display 'On' for other SAPIs instead of STDOUT or STDERR */ |
| 153 | +- cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg")); |
| 154 | ++ cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro")); |
| 155 | + |
| 156 | + switch (mode) { |
| 157 | + case PHP_DISPLAY_ERRORS_STDERR: |
| 158 | +@@ -1470,7 +1470,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c |
| 159 | + } |
| 160 | + } else { |
| 161 | + /* Write CLI/CGI errors to stderr if display_errors = "stderr" */ |
| 162 | +- if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg")) && |
| 163 | ++ if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro")) && |
| 164 | + PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR |
| 165 | + ) { |
| 166 | + fprintf(stderr, "%s: ", error_type_str); |
| 167 | +diff --git a/win32/console.c b/win32/console.c |
| 168 | +index 9b485610..a2b764cd 100644 |
| 169 | +--- a/win32/console.c |
| 170 | ++++ b/win32/console.c |
| 171 | +@@ -111,6 +111,6 @@ PHP_WINUTIL_API BOOL php_win32_console_is_own(void) |
| 172 | + |
| 173 | + PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void) |
| 174 | + {/*{{{*/ |
| 175 | +- return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1); |
| 176 | ++ return (strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1)) || 0 == strcmp(sapi_module.name, "micro"); |
| 177 | + }/*}}}*/ |
| 178 | + |
0 commit comments