From:             rodsouza at celepar dot pr dot gov dot br
Operating system: Debian Lenny
PHP version:      6CVS-2009-05-13 (snap)
PHP Bug Type:     *Unicode Issues
Bug description:  Source and result of database have different encodings.

Description:
------------
When I try to access an array by a key that was created by
'pg_fetch_array' or 'PDOStatement::fetchAll' the result is 'NULL'.

Reproduce code:
---------------
$sql = "SELECT * from phpgw_config WHERE config_app='phpgwapi' and
config_name='webserver_url'";

##
#Result
#
#Array
#(
#   [config_app] => phpgwapi
#   [config_name] => webserver_url
#   [config_value] => /expresso
#)
##

( $conn = pg_pconnect("dbname=expresso user=postgres") )
    or die( 'A error occured at line #' . __FILE__ . "\n" );
    
( $result = pg_query($conn, $sql ) )
    or die( 'A error occured at line #' . __FILE__ . "\n" );
    
$config = array( );

$config[ 'something' ] = array(
    'key_1' => 'anything',
    'key_2' => 'otherthing'
);  

$config[ 'server' ] = pg_fetch_array( $result, NULL, PGSQL_ASSOC );

var_dump( $config[ 'server' ][ 'config_name' ] );

try
{
    $pdo = new PDO('pgsql:dbname=expresso', 'postgres');
    
    $pdo_stmt = $pdo -> prepare( $sql );

    $pdo_stmt -> execute( );

    $config[ 'server' ] = $pdo_stmt -> fetch( PDO::FETCH_ASSOC );

    var_dump( $config[ 'server' ][ 'config_name' ] );
}
catch ( PDOException $e )
{
    echo 'PDO ERROR: ' . $e -> getMessage( );
}

Expected result:
----------------
webserver_url
webserver_url

Actual result:
--------------
NULL
NULL

-----

If:

var_dump( $config[ 'server' ][ b'config_name' ] );

The result is 'webserver_url'.

The problem is that I have a great application that have 1146 PHP files
and it is impossible to search for all the places that need this change.

-- 
Edit bug report at http://bugs.php.net/?id=48265&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48265&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48265&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48265&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48265&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48265&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48265&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48265&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48265&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48265&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48265&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48265&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48265&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48265&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48265&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48265&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48265&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48265&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48265&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48265&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48265&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48265&r=mysqlcfg

Reply via email to