php / php/php-src

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

Abierto
#21,538 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Feature Status: Verified
Lenguaje dominante
C
Estrellas
40.4k
Forks
8.2k
Merge medio
2 d 13 h
PR fusionados (30 d)
96

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

No se especifica ningún archivo fuente ni ninguna prueba. Reproduce la advertencia con zend.multibyte establecido en 0 y 1 usando los valores declare(encoding=...) indicados y determina después el comportamiento previsto de la advertencia; se considera terminado cuando el comportamiento acordado está implementado y cubierto por comprobaciones de regresión.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
c, php
Área
backend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.