Re: Multibyte and declate (PHP5.4)
| From: | Sebastian Krebs | Date: | Fri, 12 Aug 2011 05:52:54 +0000 |
| Subject: | Re: Multibyte and declate (PHP5.4) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54513@lists.php.net to get a copy of this message | ||
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