#48170 [Com]: Array key differentiates between unicode and binary strings
ID: 48170
Comment by: rodrigosouzadossantos at gmail dot com
Reported By: rodrigosouzadossantos at gmai dot com
Status: Feedback
Bug Type: *Unicode Issues
Operating System: Debian Lenny
PHP Version: 6CVS-2009-05-06 (snap)
New Comment:
Hi,
When I created this bug I missed my e-mail. I wrote 'gmai.com' instead
of 'gmail.com'.
So I can not recover the password to edit this post and provide more
information.
Is there any way to change my e-mail address?
Thank in advance.
Rodrigo Souza
Previous Comments:
------------------------------------------------------------------------
[2009-05-06 19:50:08] fa@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
Works for me with CVS HEAD on Debian lenny.
Are you sure the input from Postgres is not to blame?
Code:
-----
$result[ 'app1' ] = 'app value';
$result[ 'app2' ] = 'some value';
print_r( $result );
var_dump( $result[ 'app1' ] );
var_dump( $result[ b'app1' ] );
Result:
-------
Array
(
[app1] => app value
[app2] => some value
)
unicode(9) "app value"
NULL
------------------------------------------------------------------------
[2009-05-06 18:00:14] rodrigosouzadossantos at gmai dot com
Description:
------------
I have a array that is populated with result query from a Postgres. The
keys of array are the field name and the value are the field value. Like
this:
Array
(
[app1] => app value
[app2] => some value
)
Reproduce code:
---------------
$result[ 'app1' ] = 'app value';
$result[ 'app2' ] = 'some value';
print_r( $result );
var_dump( $result[ 'app1' ] );
Expected result:
----------------
string(9) "app value"
Actual result:
--------------
NULL
The result of var_dump is correct when is puts a 'b' (binary) before
string, like:
var_dump( $result[ b'app1' ] );
Is it the expected behavior?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48170&edit=1
Thread (3 messages)