Fatal Error (issue with mb_regex_encoding, pcntl, and tput in Windows)
ziova opened this issue · comments
Fatal error: Uncaught Error: Call to undefined function mb_regex_encoding() in C:\Users\hp\h-m-m\h-m-m:23
Stack trace:
#0 {main}
thrown in C:\Users\hp\h-m-m\h-m-m on line 23
I get this when i use php .\h-m-m on Windows 10
I looked it up: seemingly you need to have mbstring
installed (which is one of our dependencies and you should do it anyway), and it needs to "have the mb_regex_encoding option enabled"... whatever it means!
Regardless, it seems that if mb_regex_encoding
is not set, the mb_internal_encoding
will be used, and since we don't need different encodings for them, I just removed the former. Please check with the current version to see whether or not it works and let me know.
If the current version doesn't work either, then we should find how to set that option.
Turns out mbstring was not installed, the problem still suffices but I think that is because pcntl is not installed. pcntl (afaik) is not compatible with W10, so not sure how the script will work. Correct me if im wrong, thank you
Yes, I looked it up, and it turns out that pcntl
is only for unix-like systems.
In the beginning, I used it as a trigger to run a function and return the screen to its normal setting when a user presses ctrl+c
to exit the application. Later, I found a way to capture ctrl+c
and process it myself, and I forgot that I won't need that trigger anymore.
So, pcntl
is removed now. Can you run the application in Windows now?
Wow, thanks for the fix, this is the furthest it has gone on my machine, however, there is a new error now. The screen just goes blank and produces this error:
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 929
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 929
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1374
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1374
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1376
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1376
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1785
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1785
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1788
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1788
'tput' is not recognized as an internal or external command,
operable program or batch file.
'tput' is not recognized as an internal or external command,
operable program or batch file.
PHP Warning: str_repeat() expects parameter 2 to be int, string given in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 2407
Warning: str_repeat() expects parameter 2 to be int, string given in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 2407
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 929
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 929
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1374
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1374
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1376
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1376
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1785
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1785
PHP Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1788
Warning: A non-numeric value encountered in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 1788
'tput' is not recognized as an internal or external command,
operable program or batch file.
'tput' is not recognized as an internal or external command,
operable program or batch file.
PHP Warning: str_repeat() expects parameter 2 to be int, string given in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 2407
Warning: str_repeat() expects parameter 2 to be int, string given in C:\Users\hp\Downloads\018 - Others\hmm-test\h-m-m\h-m-m on line 2407
OK, then tput
(which we use to get the terminal dimensions and enable the alternate screen) doesn't work in Windows as well :) Before trying to find a solution for that, I checked the rest of the code, and it seems that at least stty
, which we use to disable echo, ctrl+c, etc. doesn't work either.
I couldn't find an straightforward answer for screen buffer management in Windows in a quick search. So, I'm going to close this issue and open another one for making the program compatible with Windows, and I'll leave that to potentially interested contributors.
I guess you can run h-m-m with Windows Subsystem for Linux if you're interested.