Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Review which characters should be `trim`med for cookie and header data

Aperta
#1,084 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 9 giorni

@asllanmaciel ci sta già lavorando.

Dal 17/9/2026.

  • #1086 di @asllanmaciel — aperta

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

Status: help wanted Type: testing/chores/QA

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 $characters parameter.
  • Made the $characters being 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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WordPress/Requests

Tutte le issue di WordPress/Requests

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.