Edit report at https://bugs.php.net/bug.php?id=55774&edit=1

 ID:                 55774
 Updated by:         ahar...@php.net
 Reported by:        inge at upandforward dot com
 Summary:            Array index limitation
-Status:             Open
+Status:             Feedback
-Type:               Feature/Change Request
+Type:               Bug
-Package:            *General Issues
+Package:            Scripting Engine problem
 Operating System:   php 5.3.5-1ubuntu7.2
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

I can't reproduce this at all in a standalone script:
http://codepad.viper-7.com/pZswtF shows an example of a UTF-8 encoded
array key being set properly. (I wrote another test that persists a
similar array key across multiple pages via $_SESSION, and that worked
as expected too.)


Previous Comments:
------------------------------------------------------------------------
[2011-09-24 18:41:08] inge at upandforward dot com

Description:
------------
Array indexes, although they can be strings, are not allowed to contain 
national characters, even if encoded as UTF-8.
Thus, a string like "øvinger" becomes "vinger", and "Æsop" becomes "sop".
This is very unfortunate.

My example builds an array of "name only" indexes, all in lower case.
Each entry of the array contains the complete filename of the corresponding 
file.
This serves as a fast and relatively safe method to find the correct path to a 
file, regardless of case.

I tested using, among others, a file named "php/Øvinger.php".
DS is Directory Separator (/),
$filetypes is an array containing file types to search for (like "php")
lowercase and name_only should be self-explanatory.

Test script:
---------------
//      First time only: Find all php files in
//      the 'php', 'inc' and 'txt' directories.

if (!isset ($_SESSION['long']))
{       $_SESSION['long'] = array();
        foreach ($filetypes as $dir)
        {       $files = glob ($dir.DS."*.$dir");
// Save all info for each file. This means that we won't have to
                foreach ($files as $file)               // search any more.
                {       $name = lowercase(name_only ($file));
                        $_SESSION['long'][$name] = $file;
                }
        }
}


Expected result:
----------------
$_SESSION['long']['øvinger'] contains "php/Øvinger"




Actual result:
--------------
$_SESSION['long']['vinger'] contains "php/Øvinger"



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55774&edit=1

Reply via email to