fix/php-cs-fixer #5538
Labels
Clear labels
Accessibility
bug
build
cgi Scripting
design
disruptive
documentation
duplicate
easy
enhancement
feature-request
help wanted
javascript
priority/low
question
system-hackers
tagging
text
translations
wait/bugfix
wait/inprogress
wait/misc
wait/proofread
wontfix
xsl
Requires careful coordination and documentation changes
Improving what is already there
No labels
cgi Scripting
Milestone
No items
No Milestone
Assignees
albert (Albert Dengg)
alex.busch (alex.busch)
alex.sander (alex.sander)
anaghz (anaghz)
annarita.russo (annarita.russo)
ao (André Ockers)
bonnie (bonnie)
ciampix (Marco Ciampa)
cryptie (cryptie)
dario (dario)
delliott (delliott)
dfajfer (Damian Fajfer)
dmaphy (Dominic Hopf)
doczkal (Thomas Doczkal)
eal (eal)
egnun (Erik Grun)
eventregbot (eventregbot)
fi (fi)
floriansnow (Florian Snow)
gabriel.ku (gabriel.ku)
guido (guido)
hf (hf)
hugo (hugo)
ineiev (ineiev)
jithendra (jithendra)
jn (jn)
jzarl (jzarl)
linus (Linus Sehn)
lucabon (Luca Bonissi)
lucas.lasota (lucas.lasota)
max.mehl (Max Mehl)
mk (Matthias Kirschner)
monochromec (monochromec)
mweimann (Michael Weimann)
nico.rikken (nico.rikken)
patrick (Patrick Ohnewein)
reinhard (Reinhard Müller)
renovate-bot (Renovate Bot)
repentinus (Heiki Lõhmus)
schiessle (Björn Schießle)
silviarbgl (Silvia Rbgl)
sofiaritz (Sofía Aritz)
tobiasd (tobiasd)
vincent (vincent)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: FSFE/fsfe-website#5538
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
fixes some issues with the latest version of php-cs-fixer and runs it on all files.
solved the ci hangs we are seeing in #5528 and #5512
90f597403bto5bedb6a3915bedb6a391toa82b2c5276@@ -4,3 +4,2 @@{$dir = dirname(__FILE__) . '/../templates';$result = file_get_contents("$dir/$template");$dir = dirname(__FILE__).'/../templates';The spaces around the
.had been there for readability of the code. Do they have to be removed to make the linter happy?It seems so.
@@ -25,3 +27,3 @@$alphabet = '0123456789abcdefghijklmnopqrstuvwxyz';$ret = '';for ($digits; $digits > 0; $digits--) {for ($digits; $digits > 0; --$digits) {Don't we miss one digit here with the change? As the counter is first reduced before checked if it is larger then 0. Could you check that the returned string has the correct length please?
Some quick testing in a REPL shows that they are equivalent:
@@ -254,3 +255,1 @@$digit ."-" .$eventhash;for ($count = 1; $count <= 30; ++$count) {Same for the resulting length of the string here because of the changed handling of the loop counter, though I think it does not matter much in this case.
Again, REPL testing shows equivelance:
@@ -59,3 +59,3 @@$filename = preg_replace('~[<>:"/\\|?*]| # file system reserved https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words[<>:"/\|?*]| # file system reserved https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_wordsDid PHP change behavior here, that the
\does not need to be masked anymore?So, I did some testing in a REPL, using php84, the one in use in deployment. And it turns out we never escaped backslashes properly. So php-cs-fixer presumed we were just making a mess of escaping the pipe operator, and streamlined it.
See below for examples:
In response to all comments: I have just let the linter loose and know very little about the changes it is making. I have disabled risky changes and only enabled essentially the default ruleset, so I imagine it should not break things. But perhaps I am too faithful in the quality of it.
Best thing to do is deploy this on test and run through all scripts at some point?
Seeing as this is likely going to be a longer thing now, I have added the minimal fix
--no-interactiveto the prs blocked on this, so this is now a separate thing we can solve at leisure.a82b2c5276to015c335554015c335554tob1c0826eadb1c0826eadtodd84e65f70Going to take a while to land this, so to unblock stuff landed a simpler version that does not impose strict linting:
#5549
dd84e65f70to856202a68eSO, had a look there and it seems in all cases behavior is the same before and after the lint run.
I have not tested the CGI scripts in deployment, but evaluating expressions in the repl shows the same behavior before and after the lint run.
Seeing as we use only the default ruleset, with all risky rules disabled I think it unlikely this has broken anything.
SO, had a look there and it seems in all cases behavior is the same before and after the lint run.
I have not tested the CGI scripts in deployment, but evaluating expressions in the repl shows the same behavior before and after the lint run.
Seeing as we use only the default ruleset, with all risky rules disabled I think it unlikely this has broken anything.
But I am not hugely familiar with PHP or php-cs-fixer, so that is not a very weighty opinion.
856202a68eto69e71d571c