[TYPO3-50-general] PHP6 array keys unicode issue
Robert Lemke
robert at typo3.org
Wed Jun 13 14:52:12 CEST 2007
Hey bleeding-edge-PHP-users,
I just stumbled over a weird behaviour with PHP6. Consider the
following code (with unicode_semantics
enabled):
<?php
preg_match('/(?P<character>\w),/', 'a,b,c,d', $matches);
echo (isset($matches[(binary)'character']) ? 'yes ' : 'no ');
echo (isset($matches[(unicode)'character']) ? 'yes ' : 'no ');
$matches = array('character' => 'a');
echo (isset($matches[(binary)'character']) ? 'yes ' : 'no ');
echo (isset($matches[(unicode)'character']) ? 'yes ' : 'no ');
?>
The regular expression creates an associative array with "character"
as the key.
My expected output is:
no yes no yes
But it is
yes no no yes
The preg_match seems to use a "binary" string as the index while my
manual assignment
uses a unicode string.
The question is if that is a wanted behaviour and if we can rely on
that. I just wanted
to hear your opinion about it before I ask in one of the PHP lists ...
robert
--
http://typo3.org/gimmefive
More information about the TYPO3-project-5_0-general
mailing list