Hi internals,
I am writing to ask for suggestions in bug Issue #21538 in php-src 1. Currently when zend.multibyte=0, declare(encoding=…) will emit a warning for whatever the encoding is:
“PHP Warning: declare(encoding=…) ignored because Zend multibyte feature is turned off by settings in XXX”
And the problem is when the encoding is ASCII or UTF-8, which is, not a multibyte encoding method, the warning will still be emitted. So, if zend.multibyte=0 and you use files with declare(encoding=ASCII) it will emit the error message to make people want to remove them.
Now, since declare(encoding=UTF-8) behaves identically whether zend.multibyte is on or off, the warning is quite misleading. Also I think people might mostly use them as documenting codes to tell tools how to decode them because when zend.multibyte=0, PHP already parses source files as UTF-8 by default.
However, it is also reasonable to say people might want to use these warnings to check if their code bases have useless codes.
So I would suggest to change the warning message in those cases to
“PHP Warning: declare(encoding=‘UTF-8(or ASCII)’) is useless, remove it.”
to make things clearer.
This would be a very minor change and do not worth a separate RFC. However, I think it is still important to send a email to gather opinions
Also thank @alexdowad for giving me ideas. TiA ![]()
–Weilin Du