-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.3 not working on Windows 7 #12762
Comments
Windows 7 has been out of support for almost 4 years. Windows server 2008 r2 is out of support except on some azure services where support will end in 2 months. |
This is an intentional change and also listed in the upgrade guide for 8.3 |
Thx! However, if |
What I don't like about the current patch is how it will keep retrying GetProcAddress even if the first attempt failed. Not sure how others feel about supporting unsupported OS. |
I am going to close this as wontfix. |
I agree, we should no longer support Windows 7 in new versions. We shoud keep compatibility on 8.2 but it's fine if 8.3 will no longer support it. |
Hi,
Finaldiff --git "a/Zend/zend_call_stack.c" "b/Zend/zend_call_stack.c"
index 06ee521911..0ac230a0bd 100644
--- "a/Zend/zend_call_stack.c"
+++ "b/Zend/zend_call_stack.c"
@@ -376,7 +376,19 @@ static bool zend_call_stack_get_win32(zend_call_stack *stack)
* v Lower addresses v
*/
- GetCurrentThreadStackLimits(&low_limit, &high_limit);
+ typedef void (WINAPI* FuncT)(PULONG_PTR , PULONG_PTR);
+ HINSTANCE hDLL = LoadLibrary("Kernel32.dll");
+ FuncT GetCurrentThreadStackLimits = (FuncT) GetProcAddress((HMODULE)hDLL, "GetCurrentThreadStackLimits");
+ if (GetCurrentThreadStackLimits) {
+ GetCurrentThreadStackLimits(&low_limit, &high_limit);
+ } else {
+ NT_TIB* tib = (NT_TIB*)NtCurrentTeb();
+ high_limit = (ULONG_PTR)tib->StackBase;
+ MEMORY_BASIC_INFORMATION mbi;
+ if (VirtualQuery(tib->StackLimit, &mbi, sizeof(mbi))) {
+ low_limit = (ULONG_PTR)mbi.AllocationBase;
+ }
+ }
result_size = VirtualQuery((void*)low_limit,
&uncommitted_region, sizeof(uncommitted_region)); Debugdiff --git "a/Zend/zend_call_stack.c" "b/Zend/zend_call_stack.c"
index 06ee521911..eebf45feb5 100644
--- "a/Zend/zend_call_stack.c"
+++ "b/Zend/zend_call_stack.c"
@@ -23,6 +23,7 @@
#include "zend_portability.h"
#include "zend_call_stack.h"
#include <stdint.h>
+#include <time.h>
#ifdef ZEND_WIN32
# include <processthreadsapi.h>
# include <memoryapi.h>
@@ -376,7 +377,37 @@ static bool zend_call_stack_get_win32(zend_call_stack *stack)
* v Lower addresses v
*/
- GetCurrentThreadStackLimits(&low_limit, &high_limit);
+ clock_t begin = clock();
+ typedef void (WINAPI* FuncT)(PULONG_PTR , PULONG_PTR);
+ HINSTANCE hDLL = LoadLibrary("Kernel32.dll");
+ FuncT GetCurrentThreadStackLimits = (FuncT) GetProcAddress((HMODULE)hDLL, "GetCurrentThreadStackLimits");
+ if (GetCurrentThreadStackLimits) {
+ GetCurrentThreadStackLimits(&low_limit, &high_limit);
+ ULONG_PTR tmp_low_limit, tmp_high_limit;
+ NT_TIB* tib = (NT_TIB*)NtCurrentTeb();
+ tmp_high_limit = (ULONG_PTR)tib->StackBase;
+ MEMORY_BASIC_INFORMATION mbi;
+ if (VirtualQuery(tib->StackLimit, &mbi, sizeof(mbi))) {
+ tmp_low_limit = (ULONG_PTR)mbi.AllocationBase;
+ }
+ fprintf(stderr, "GetCurrentThreadStackLimits (%lu =? %lu) (%lu =? %lu)\n",(uintptr_t)low_limit, (uintptr_t)tmp_low_limit,(uintptr_t)high_limit,(uintptr_t)tmp_high_limit);
+ fprintf(stderr, "GetCurrentThreadStackLimits %lu %lu\n",(uintptr_t)low_limit,(uintptr_t)high_limit);
+ } else {
+ NT_TIB* tib = (NT_TIB*)NtCurrentTeb();
+ high_limit = (ULONG_PTR)tib->StackBase;
+ MEMORY_BASIC_INFORMATION mbi;
+ if (VirtualQuery(tib->StackLimit, &mbi, sizeof(mbi))) {
+ low_limit = (ULONG_PTR)mbi.AllocationBase;
+ }
+ fprintf(stderr, "StackLimitStackBase %lu %lu\n",(uintptr_t)low_limit, (uintptr_t)high_limit);
+ }
+ clock_t end = clock();
+ unsigned long millis = (end - begin) * 1000 / CLOCKS_PER_SEC;
+ fprintf(stderr, "time_spent %lu\n",millis);
result_size = VirtualQuery((void*)low_limit,
&uncommitted_region, sizeof(uncommitted_region)); |
Less than 50 lines of code needed to support an entire operating system? I think that's an insult to the entire Win 7 community. |
making it compile is one thing. maintaining it and hunting upcoming bugs is the time consuming story - at the cost of having less time for the people doing a great job in using modern systems |
I completely understand. I meant Windows 7 is still quite in use and as long as those were minor changes like these I think that those extra few minutes are justified. Of course later as more and more things will break it will come naturally to drop its compatibility, but as far I saw so far it's quite simple to maintain. |
Less than 50 lines of code needed to support an entire operating system... even if it were 200 lines, it sounds like a bad joke. Six months... , two weeks since this push. May we keep using PHP in Windows 7, please. |
It's also about keeping those lines up to date and tested. |
If any of you encounters an advertising pop-up after Windows 11 has scanned your personal data and activities, what is shared with no less than another thousand companies, I trust you will have no objection, because it is a modern system and modernity. On Windows 10, advanced prototype of such spyware era, very soon a campaign will be activated in an attempt to pressure all of you to migrate with the same seeds used against Windows 7 under the "it's an out of support OS!" umbrella. In many cases, this will end with all of you buying unneeded hardware, even a complete computer, and once again, I trust that none of you will have any objections. In fact, I trust that you will all have no objections with the long updates blocking the system when you need it, or the general performance with unjustified services that will be re-enabled until you notice your setting was overrided. But some of us don't want the above mentioned problems, or don't want any other related ones (I guess each person uses Windows 7 under their own reasons, from hardware performance or so on).
I think the people using Windows 7 -version where all the ports can be closed with a firewall of our election and the system still works- already knows that it is a insecure system, as insecure as the last updated of the promoted Windows. If an infected file gets into the system, there is nothing you can do. If you have opened the ports of the Windows services, there is nothing you can do, zero-day will come to you.
If a careless modification of those lines fails in Windows 7, it is my guess that someone will notice, come, and try to suggest a solution. |
Forcing everyone to build is anything but freedom. |
First, I agree that Microsoft is building spyware and bloat into their operating system. Note that just blocking off ports on Windows 7 is not a solution because vulnerabilities such as buffer overflows and other nasty stuff don't necessarily need to be in the applications you use, they can very well be in the TCP/IP layer of the kernel for example. In that case a firewall isn't going to protect you necessarily.
No, it is freedom, and a lot of freedom in fact. The source code is available and you can do anything with it and change it to your likings (within the conditions of the license). How is this not freedom? This thread isn't going anywhere and I'm pretty sure the decision of the people who replied here are final. |
Description
Hi,
Just trying to run PHP 8.3.0 on Windows 7 (after successfully compiling it on Win11 vs17 x64) and it's failed with message
According to https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentthreadstacklimits it's normal as requirements are:
It had also been clearly mentioned on #9104 (comment)
Looking to the source code, I found
GetCurrentThreadStackLimits
used inZend/zend_call_stack.c
Based on https://stackoverflow.com/a/52404641 I dirtily applied the patch and now PHP 8.3.0 run fine on windows 7
So... Does this patch (or a corrected one as I don't really master all the elements) would make sense to ensure PHP a long life on old Windows OS ?
PHP Version
PHP 8.3.0
Operating System
Windows 7 x64
The text was updated successfully, but these errors were encountered: