php / php/php-src

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

Offen
#21,538 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Feature Status: Verified
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Keine Quelldatei und kein Test werden genannt. Reproduziere die Warnung mit zend.multibyte auf 0 und 1 gesetzt unter Verwendung der aufgeführten declare(encoding=...)-Werte und bestimme anschließend das beabsichtigte Warnverhalten; abgeschlossen bedeutet, dass das vereinbarte Verhalten implementiert und durch Regressionstests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, php
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.