Edit report at https://bugs.php.net/bug.php?id=72768&edit=1
ID: 72768
Comment by: mlocati at gmail dot com
Reported by: mlocati at gmail dot com
Summary: Add ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for
php.exe
Status: Analyzed
Type: Feature/Change Request
Package: Output Control
Operating System: Windows 10
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
What about continuing this discussion on a new pull request at https://github.com/php/php-src ?
Previous Comments:
------------------------------------------------------------------------
[2016-08-26 16:38:48] mlocati at gmail dot com
I changed the stream_vt100_support function to accept strings ('php://stdout',
'php://stderr') instead of stream objects.
This is a bit a workaround, but I really don't know how to determine the standard stream
(stdin/stdout/stderr) from stream objects.
See patch 0001-Start-adding-VT100-support-for-Windows-v3
------------------------------------------------------------------------
[2016-08-26 14:14:45] mlocati at gmail dot com
I finally managed to compile php (basically an include of php.h was missing) - see attached patch
0001-Start-adding-VT100-support-for-Windows-v2.
Just one thing remains to be done: how to get the standard Windows handle (eg
STD_INPUT_HANDLE/STD_OUTPUT_HANDLE/STD_ERROR_HANDLE) starting from a php_stream?
I thought it was possible by inspecting stream->orig_path, but it's not the case.
Any hint?
------------------------------------------------------------------------
[2016-08-25 13:09:10] mlocati at gmail dot com
I tried to add this new function, and since this is my first attempt to contribute to PHP I'm
surely doing something wrong: the compilation fails with strange messages (redefinitions of #define,
structs, functions).
------------------------------------------------------------------------
[2016-08-22 09:34:47] ab@php.net
@mlocati, I only mentioned the control sequences stripping as a result of further deliberation. Bash
does it, as you mentioned. ASCII (compatible) would be probably easy to do, but not sure with double
byte and other mb encodings. So mentioned it, just to keep in mind, this option is possible.
Otherwise - yeah, what we discuss till now as an initial plan is to not to strip control sequences
automatically.
Thanks.
------------------------------------------------------------------------
[2016-08-22 07:02:37] mlocati at gmail dot com
@ab I don't fully understand the point about stripping the control sequences...
Given that
1. PHP developers have a way to know if STDOUT/STDERR support control sequences (#72768)
2. PHP developers have a way to know if STDOUT/STDERR are not redirected to a file (#72896)
they may decide to send the control sequences or not.
On the other hand, even if the PHP developers know that the output does not support control
sequences, they may need to output them. I don't see a reason why they would want to do that,
but I think developers should be as free as they want.
Furthermore, stripping out chars could be risky and requires a deep study.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72768
--
Edit this bug report at https://bugs.php.net/bug.php?id=72768&edit=1