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

`json_decode()`: `JSON_INVALID_UTF8_*` flags should be mutually exclusive

Aperta
#23,876 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php

Direzione di ricerca

Start by reproducing the three json_decode() calls shown in the issue and tracing how JSON_INVALID_UTF8_IGNORE and JSON_INVALID_UTF8_SUBSTITUTE are validated. Done means the individual flags retain their current results while using both together raises the expected ValueError; add or update a regression test for the combined flags.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Extension: json Status: Needs Triage
Description

The following code:

<?php

var_dump( json_decode( "\"a\xb0b\"", null, 512, JSON_INVALID_UTF8_IGNORE ) );
var_dump( json_decode( "\"a\xb0b\"", null, 512, JSON_INVALID_UTF8_SUBSTITUTE ) );
var_dump( json_decode( "\"a\xb0b\"", null, 512, JSON_INVALID_UTF8_IGNORE | JSON_INVALID_UTF8_SUBSTITUTE ) );

Resulted in this output:

string(2) "ab"
string(5) "a�b"
string(5) "a�b"

But I expected this output instead:

string(2) "ab"
string(5) "a�b"
<some kind of ValueError>
PHP Version
PHP 8.5.10, 3v4l
Operating System

No response

Lingua principale
C
Stelle
40.4k
Fork
8.2k
Merge medio
2g 15h
PR unite (30g)
113

Guida per i contributori

Apri la guida per i contributori

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 php/php-src

Tutte le issue di php/php-src

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.