Hi,
With PHP5.4 I get this warning
| Warning: declare(encoding=...) ignored because Zend multibyte feature
| is turned off by settings in [..]
because of
| declare(encoding = 'UTF-8');
An except from the manual [1]
The encoding declare value is ignored in PHP 5.3 unless php is compiled with --enable-zend-multibyte.
Does this really means, that this declare statement is ignored, when
PHP is not compiled with "--enable-zend-multibyte", but it yields a
warning (and not even just a notice), when it is (what is default now)?
That feels a little bit inconsistent to me.
And btw: Its probably asked before, but is there a reason, why
multibyte-support is disabled by default?
Regards,
Sebastian
Hi Sebastian
2011/8/11 Sebastian Krebs sebastian.krebs.berlin@googlemail.com:
Hi,
With PHP5.4 I get this warning
| Warning: declare(encoding=...) ignored because Zend multibyte feature
| is turned off by settings in [..]because of
| declare(encoding = 'UTF-8');
An except from the manual [1]
In PHP 5.4, the compile time switch was removed and made into an ini
directive, which lives under the name of zend.multibyte = [On|Off].
For the question about declare's availability: No Zend Multibyte
support does not make the engine ignore the construct totally, as we
also got another statement; ticks that can be used in declare aswell.
For the question about why its not enabled by default? Performance,
you don't want to enable multibyte support when most of your code
lives in a single byte char format anyway, some calls are most costly
because you can no longer jump just one byte and have to validate what
kind of character sequence we're at now.
--
regards,
Kalle Sommer Nielsen
kalle@php.net
Hi,
2011/8/11 Kalle Sommer Nielsen kalle@php.net
Hi Sebastian
2011/8/11 Sebastian Krebs sebastian.krebs.berlin@googlemail.com:
Hi,
With PHP5.4 I get this warning
| Warning: declare(encoding=...) ignored because Zend multibyte feature
| is turned off by settings in [..]because of
| declare(encoding = 'UTF-8');
An except from the manual [1]
In PHP 5.4, the compile time switch was removed and made into an ini
directive, which lives under the name of zend.multibyte = [On|Off].
Ah, I see. multibyte is either compiled in, or not (PHP5.3), or its either
enabled, or not (PHP5.4). Now I see a difference between "not compiled in"
(declare(encoding) is ignored) and "not enabled" (declare(encoding) throws a
warning).
For the question about why its not enabled by default? Performance,
you don't want to enable multibyte support when most of your code
lives in a single byte char format anyway, some calls are most costly
because you can no longer jump just one byte and have to validate what
kind of character sequence we're at now.
This means, that either the file is ASCII and I should omit the
declare(encoding)
-statement [1], or its not ASCII, but then -- when
multibyte is disabled -- I should not assume, that everything works fine?
That is, what the warning should tell me?
[1] Sidenote: Maybe it could ignore declare(encoding='ASCII') ;)
--
regards,Kalle Sommer Nielsen
kalle@php.net
At all I think now, that the warning is probably the better reaction than
just doing nothing. No further question, thanks for that :)
Regards,
Sebastian