From:             TheRealAL at gmail dot com
Operating system: Debian GNU/Linux
PHP version:      5.2.5
PHP Bug Type:     PostgreSQL related
Bug description:  pg_send_query_params converts all elements in 'params' to 
strings

Description:
------------
Is seems pg_send_query_params internally converts all parameters passed in
array 'params' to strings.
It's very strange, because 'params' is passed by-value. And much more
strange - if 'params' was passed from some wrapper function (in which it
was passed by-value), original value of this array will be modified even
outside wrapper.

Configure Command =>  './configure'  '--prefix=/usr/local/php5-mod'
'--disable-all' '--with-apxs2=/usr/local/apache2-php5/bin/apxs'
'--enable-cli' '--disable-cgi' '--disable-ipv6' '--with-pcre-regex'
'--with-zlib' '--enable-hash' '--enable-mbstring' '--with-pgsql'
'--enable-session' '--enable-wddx' '--enable-libxml' '--enable-xml'

Reproduce code:
---------------
function query($dbh, $sql, $params)//$params: passed by value!!!
{
        pg_send_query_params($dbh, $sql, $params);
        // ...
}


$dbh = pg_connect('host=localhost dbname=esp user=esp password=pass');


$foo = array(5, 10);
var_dump($foo);

query($dbh, 'SELECT data FROM test WHERE id = $1 OR id = $2', $foo);

var_dump($foo);


pg_close($dbh);

Expected result:
----------------
array(2) {
  [0]=>
  int(5)
  [1]=>
  int(10)
}
array(2) {
  [0]=>
  int(5)
  [1]=>
  int(10)
}


Actual result:
--------------
array(2) {
  [0]=>
  int(5)
  [1]=>
  int(10)
}
array(2) {
  [0]=>
  string(1) "5"
  [1]=>
  string(2) "10"
}


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

Reply via email to