Review which characters should be `trim`med for cookie and header data
I maintainer di solito rispondono entro 9 giorni
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- networking
Direzione di ricerca
Esamina le 14 chiamate a [lr]trim() che usano Trim::WHITESPACE_CHARS_NO_FF, iniziando dalle modifiche in PR #1083. Controlla l’RFC sul form-feed di trim, la documentazione di PHP e la gestione comparabile in progetti come Guzzle. Documenta le scelte verificate in questa issue; quando un valore dovrebbe cambiare, aggiungi test che coprano il valore di $characters e invia una PR.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Setting the stage
By default, the PHP native [lr]trim() functions, trim ASCII whitespace and the NUL byte character.
PHP 8.6 changes the default value of the $characters parameter to also include the form feed - "\f" - character, which was previously not trimmed.
⚠️ Keep in mind that [lr]trim() only operates on the leading and/or trailing characters for a text string. It does not affect the characters in the "middle" !
Refs:
What has already been done
Requests uses [lr]trim() in various places throughout the codebase.
To make this code PHP cross-version compatible, PR #1083 made the following changes:
- Introduced two class constants to represent the different default values for the
$charactersparameter. - Made the
$charactersbeing trimmed explicit in each of the[lr]trim()function calls (if it wasn't already).
To determine which characters should be trimmed, the following rule of thumb has been used for the initial changes made in PR #1083:
"Use the PHP 8.6 default (Trim::WHITESPACE_CHARS), except when the trimming may be subject to an RFC or other documented rules, in which case use the PHP < 8.6 default (Trim::WHITESPACE_CHARS_NO_FF)"
That way, we preserved existing behaviour in "important" places, while benefitting from the new default value everywhere else.
Task
For all calls to [lr]trim() which currently use the Trim::WHITESPACE_CHARS_NO_FF value for $characters, it should be researched whether that is correct by checking RFCs and other applicable rules. In some cases, it may also be prudent to evaluate how other projects similar to Requests, like for instance Guzzle, handle these text strings.
If the trimming is correct, it should be documented that this was verified via a comment in this issue.
If a change is necessary, please submit a PR and include tests safeguarding the change to the value passed for $characters.
After PR #1083, there will be 14 places in the codebase where this review task is necessary.
- Lingua principale
- PHP
- Stelle
- 3.6k
- Fork
- 503
- Merge medio
- 10g 23h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di WordPress/Requests
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 9 giorni
-
Release checklist for 2.0.22ApertaType: meta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
I maintainer di solito rispondono entro 9 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 9 giorni
-
testSNISupport no longer verifies SNIForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. ApertaComponent: Transports Status: help wanted Type: testing/chores/QA
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
WordPress/Requests#1077 · 1 commento ·
I maintainer di solito rispondono entro 9 giorni
-
Support fror QUERY HTTP methodForse già presa Una pull request collegata a questa issue è aperta o già unita. ApertaComponent: Core Type: enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
I maintainer di solito rispondono entro 9 giorni
Tutte le issue di WordPress/Requests
Issue simili
-
priority:low type:docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
crazy-goat/rabbit-stream#958 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nextcloud/richdocuments#6250 ·
I maintainer di solito rispondono entro 1 giorno
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
sync-en
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
FOSSBilling/FOSSBilling#4605 ·
I maintainer di solito rispondono entro 1 giorno