php / php/php-src

declare(encoding=...) ignored because Zend multibyte feature is turned off by settings for ASCII or UTF-8

Aperta
#21,538 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Feature Status: Verified
Lingua principale
C
Stelle
40.4k
Fork
8.2k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

Description

Hello :),

Assume you mix files in distinct encodings in various projects.
If some are in ISO-8859-1 or ISO-8859-15 for example,
and others are in UTF-8.
You can have the habit to always use:

declare(encoding='ISO-8859-1')
// or
declare(encoding='ISO-8859-15')
// or
declare(encoding='UTF-8')
// or
declare(encoding='ASCII')

However, if zend.multibyte=0 and you use files with:

declare(encoding='UTF-8')
// or
declare(encoding='ASCII')

you will get

PHP Warning:  declare(encoding=...) ignored because Zend multibyte feature is turned off by settings in

which makes you want to remove them.

And if zend.multibyte=1 and you use files with all declare(encoding=...)
you will get no warning.

I would prefer that PHP states clearly what is preferred when the files can be used separately,
and hence some of these files without Zend multibyte:

  • If the prefered solution is to always have the declare(encoding=...) directive,
    then the warning
    PHP Warning:  declare(encoding=...) ignored because Zend multibyte feature is turned off by settings in
    
    should be suppressed for encodings that do not require multibyte.
  • If the prefered solution is to never have the declare(encoding=...) directive for encodings that don't need it,
    then the warning should be distinct:
    PHP Warning:  declare(encoding='UTF-8') is useless, remove it.
    
    and appear whatever the value of Zend multibyte configuration.

Thanks, best regards,
Laurent Lyaudet

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.

Direzione di ricerca

Non sono specificati alcun file sorgente né alcun test. Riproduci l'avviso con zend.multibyte impostato su 0 e su 1 usando i valori declare(encoding=...) elencati, quindi determina il comportamento previsto dell'avviso; il lavoro è completato quando il comportamento concordato è implementato e coperto da verifiche di regressione.

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

Valutazione

Stack tecnologico
c, php
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.