# [PATCH] unicode_semantics "off" evaluates to true

- Thread: https://externals.io/message/21852
- Original archive: https://news-web.php.net/php.internals/21852
- Started by Brion Vibber on 2006-02-13T09:07:58+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #21852 — Brion Vibber — 2006-02-13T09:07:58+00:00

URL: https://externals.io/message/21852#21852

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I've started cautiously poking PHP 6 so I can keep an eye on how the Unicode
support is going and see what kind of work we'll eventually need to do to port
MediaWiki for it...

One thing I noticed right off is that this test doesn't do what you'd expect if
you didn't copy in one of the sample php.ini files:

if(ini_get("unicode_semantics")) { /* bla bla */ }

The default value for unicode_semantics is the literal string "off", which
evaluates to true although the setting really is off.

Attached is a one-line patch which sets it to "0" and uses the macro
STD_ZEND_INI_BOOLEAN, to match with other config settings I saw in there. This
keeps it off by default but makes the ini_get evaluate to the expected false in
a boolean test.

- -- brion vibber (brion @ pobox.com)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFD8ExuwRnhpk1wk44RAir6AKCPFd4tVpGJ8a0a/L2COvrQoiKnqQCgqAkY
h5b6AbfY40TfQKPnRHO7xv0=
=P8dd
-----END PGP SIGNATURE

---

## #21853 — Marcus Boerger — 2006-02-13T09:20:18+00:00

URL: https://externals.io/message/21852#21853 · In reply to: #21852

Hello Brion,

  i applied your fix which was correct. I however also added a function to
check for unicode mode "bool unicode_enabled()" which returns true if
unicode_semantics is set true.

best regards
marcus

Monday, February 13, 2006, 10:07:58 AM, you wrote:

> Index: Zend/zend.c
> ===================================================================
> RCS file: /repository/ZendEngine2/zend.c,v
> retrieving revision 1.333
> diff -u -r1.333 zend.c
> --- Zend/zend.c 8 Feb 2006 18:52:13 -0000       1.333
> +++ Zend/zend.c	13 Feb 2006 08:53:35 -0000
> @@ -197,7 +197,7 @@
>         STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode",     "0",   
> ZEND_INI_ALL,           OnUpdateBool,   ze1_compatibility_mode,
> zend_executor_globals,  executor_globals)
>  
>         /* Unicode .ini entries */
> -       STD_ZEND_INI_ENTRY("unicode_semantics", "off", ZEND_INI_SYSTEM,
> OnUpdateBool, unicode, zend_unicode_globals, unicode_globals)
> +       STD_ZEND_INI_BOOLEAN("unicode_semantics", "0", ZEND_INI_SYSTEM,
> OnUpdateBool, unicode, zend_unicode_globals, unicode_globals)
>         STD_ZEND_INI_ENTRY("unicode.fallback_encoding", NULL,
> ZEND_INI_ALL, OnUpdateEncoding,   fallback_encoding_conv,
> zend_unicode_globals, unicode_globals)
>         STD_ZEND_INI_ENTRY("unicode.runtime_encoding",  NULL,
> ZEND_INI_ALL, OnUpdateEncoding,   runtime_encoding_conv,
> zend_unicode_globals, unicode_globals)
>         STD_ZEND_INI_ENTRY("unicode.script_encoding",  NULL,
> ZEND_INI_ALL, OnUpdateEncoding,   script_encoding_conv,
> zend_unicode_globals, unicode_globals)




Best regards,
 Marcus

---

## #21854 — Brion Vibber — 2006-02-13T09:36:12+00:00

URL: https://externals.io/message/21852#21854 · In reply to: #21853

Marcus Boerger wrote:
>   i applied your fix which was correct. I however also added a function to
> check for unicode mode "bool unicode_enabled()" which returns true if
> unicode_semantics is set true.

Cool, thanks!

-- brion vibber (brion @ pobox.com)

---

## #21863 — Andrei Zmievski — 2006-02-13T17:26:13+00:00

URL: https://externals.io/message/21852#21863 · In reply to: #21853

I don't think it's right to call it unicode_enabled(). Unicode is 
always accessible, it's just that certain language semantics don't use 
it when unicode_semantics is off. So I'd call the function 
unicode_semantics() or unicode_default().

-Andrei



> Hello Brion,
>
>   i applied your fix which was correct. I however also added a 
> function to
> check for unicode mode "bool unicode_enabled()" which returns true if
> unicode_semantics is set true.
>
> best regards
> marcus
>
> Monday, February 13, 2006, 10:07:58 AM, you wrote:
>
> > […]
>
>
>
>
> Best regards,
>  Marcus

---

## #21864 — Marcus Boerger — 2006-02-13T19:54:36+00:00

URL: https://externals.io/message/21852#21864 · In reply to: #21863

Hello Andrei,

  changed to unicode_semantics() now.

thanks for the hint.

best regards
marcus

Monday, February 13, 2006, 6:26:13 PM, you wrote:

> I don't think it's right to call it unicode_enabled(). Unicode is 
> always accessible, it's just that certain language semantics don't use 
> it when unicode_semantics is off. So I'd call the function 
> unicode_semantics() or unicode_default().

> -Andrei

> 

> > […]
