#46634 [Opn->Bgs]: Array key differentiates between unicode and binary strings

From: Date: Sat, 03 Jan 2009 01:19:37 +0000
Subject: #46634 [Opn->Bgs]: Array key differentiates between unicode and binary strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-132518@lists.php.net to get a copy of this message
ID: 46634 Updated by: felipe@php.net Reported By: mike at mikegerwitz dot com -Status: Open +Status: Bogus Bug Type: *Unicode Issues Operating System: GNU/Linux PHP Version: 6CVS-2008-11-20 (snap) New Comment: Nowadays unicode semantics is always enabled. Previous Comments: ------------------------------------------------------------------------ [2008-11-20 19:04:04] mike at mikegerwitz dot com Description: ------------ Array keys in PHP 6 differentiate between unicode and binary strings - that is, a unicode key of 'test' is entirely different than a binary key of 'test'. Reproduce code: --------------- $arr = array(); $arr[ (unicode)'test' ] = 'unicode'; $arr[ (binary)'test' ] = 'binary'; // If unicode semantics is enabled, this will output 'unicode' var_dump( $arr['test'] ); // Will output 'binary' var_dump( $arr[ b'test'] ); // Will output 'unicode' var_dump( $arr[ (unicode)'test' ] ); Expected result: ---------------- All three lines should output 'binary' unicode(7) "binary" unicode(6) "binary" unicode(7) "binary" Actual result: -------------- unicode(7) "unicode" unicode(6) "binary" unicode(7) "unicode" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46634&edit=1

« previous php.bugs (#132518) next »