-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
windows: fgets() does not work with shebang #16147
Comments
Well, see what
According to the fine manual, this is expected:
If skip-linting.php would use double-quotes instead of single-quotes, likely all tests would fail. Quick "fix" for PHP-Parallel-Lint which makes the test pass on Windows: src/Process/Process.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/Process/Process.php b/src/Process/Process.php
index 4e72e58..c18dc6e 100644
--- a/src/Process/Process.php
+++ b/src/Process/Process.php
@@ -45,7 +45,11 @@ class Process
self::STDERR => array('pipe', self::WRITE),
);
- $cmdLine = $executable . ' ' . implode(' ', array_map('escapeshellarg', $arguments));
+ $args = "";
+ foreach ($arguments as $arg) {
+ $args .= ' "' . $arg . '"';
+ }
+ $cmdLine = $executable . ' ' . $args;
$this->process = proc_open($cmdLine, $descriptors, $pipes, null, null, array('bypass_shell' => true));
if ($this->process === false || $this->process === null) { So this doesn't look like a bug in php-src ("fixing" |
thank you for investigating this. I still wonder why it has such a strange output on windows
does it mean the "#" in the string is not the same character as the literal "#" in the source-code? update: I just realized its not the "#" but the "!":
|
I found a easy fix, thanks again. |
Ah, I wanted to suggest to use a file, but that might have been a bit slow; but since the file is already there, that looks like the best solution. |
Description
the example in question is reproducible with phpunit on windows, but I was not able to reduce it further to the actual root cause.
its super weird.
The following code:
with
example.php
:Resulted in this output:
But I expected this output instead:
No problems with the same code on Ubuntu.
The above example is not reproducible as is when running in isolation.
its reproducible though when running as part of the test-suite of PHP-Parallel-Lint (see steps below).
I think its somehow related to that the code is invoked via
$this->process = proc_open($cmdLine, $descriptors, $pipes, null, null, array('bypass_shell' => true));
Steps to reproduce the problem on a Windows machine
-> results in a PHPUnit test-failure but should succeed
this test executes skip-linting.php which fails because of the strange logic happening I described earlier.
PHP Version
PHP 8.2.12 and others
Operating System
Windows
The text was updated successfully, but these errors were encountered: