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

 ID:                 48265
 Updated by:         [email protected]
 Reported by:        rodsouza at celepar dot pr dot gov dot br
 Summary:            Source and result of database have different
                     encodings.
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            PostgreSQL related
 Operating System:   Debian Lenny
 PHP Version:        6CVS-2009-05-13 (snap)
-Assigned To:        
+Assigned To:        yohgaki
 Block user comment: N
 Private report:     N

 New Comment:

Returning NULL is perfectly ok.
You're asking debugging php code and database data.

If you are not, please describe what feature is broken. How it is broken.


Previous Comments:
------------------------------------------------------------------------
[2009-05-13 18:59:33] rodsouza at celepar dot pr dot gov dot br

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 this bug report at https://bugs.php.net/bug.php?id=48265&edit=1

Reply via email to