php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48170 Array key differentiates between unicode and binary strings
Submitted: 2009-05-06 18:00 UTC Modified: 2009-05-14 01:00 UTC
From: rodrigosouzadossantos at gmai dot com Assigned:
Status: No Feedback Package: *Unicode Issues
PHP Version: 6CVS-2009-05-06 (snap) OS: Debian Lenny
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
16 - 11 = ?
Subscribe to this entry?

 
 [2009-05-06 18:00 UTC] 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?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-06 19:50 UTC] 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-08 18:36 UTC] rodrigosouzadossantos at gmail dot com
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
 [2009-05-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jun 24 07:01:25 2021 UTC