You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Generate empty folder
mkdir tmp
cd tmp
git init
echo"vendor"> .gitignore
pbpaste > grumphp.yml
composer require --dev phpro/grumphp
# Make any change, doesn't matter# Run GrumPHP:
git add -A && git commit -m"Test"# or
./vendor/bin/grumphp run
Result:
In ParserBase.php line 87:
No match for regexp /diff --git (a\/.*) (b\/.*)\n/ Upcoming: diff --git c/i
nstallation.yml
git:pre-commit [--skip-success-output] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-c|--config CONFIG] [--] <command>
Comment
This error only happens after upgrading to PHP 7.4.7 from 7.3.x.
After upgrading to PHP 7.4, grumphp ignores the STDIN stream. Regardless of what I pass in, it always ignores it and goes with the default "no stdin provided" route. The command I use to call the tool is (truncated):
The importance of calling the script with a custom STDIN is in the -c diff.mnemonicprefix=false config used to generate the git diff. Without this config the diff is in a format that causes the ParserBase exception shown above.
I have traced the issue to this line of code: ConsoleIO:86. Here the ftell() function returns false, which means that an empty string is returned from the method. If I change the line to
if (0 !== ftell($handle) && false !== ftell($handle)) {
then everything works as expected and the stdin passed to grumphp is recognised. But I don't know if that is a sufficient fix as this might potentially hide other issues.
The text was updated successfully, but these errors were encountered:
My configuration
Steps to reproduce:
Result:
Comment
This error only happens after upgrading to PHP 7.4.7 from 7.3.x.
After upgrading to PHP 7.4, grumphp ignores the STDIN stream. Regardless of what I pass in, it always ignores it and goes with the default "no stdin provided" route. The command I use to call the tool is (truncated):
The importance of calling the script with a custom STDIN is in the
-c diff.mnemonicprefix=false
config used to generate thegit diff
. Without this config the diff is in a format that causes theParserBase
exception shown above.I have traced the issue to this line of code:
ConsoleIO:86
. Here theftell()
function returnsfalse
, which means that an empty string is returned from the method. If I change the line tothen everything works as expected and the stdin passed to grumphp is recognised. But I don't know if that is a sufficient fix as this might potentially hide other issues.
The text was updated successfully, but these errors were encountered: