|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-31 05:52 UTC] yohgaki@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: yohgaki
[2012-03-31 05:52 UTC] yohgaki@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 11:00:01 2025 UTC |
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.