ID:               41027
 User updated by:  martin at bangaroo dot net
 Reported By:      martin at bangaroo dot net
-Status:           Feedback
+Status:           Open
 Bug Type:         PDO related
 Operating System: Gentoo Linux
 PHP Version:      5.2.1
 Assigned To:      wez
 New Comment:

I just checked with the snapshot php5.2-200904261630.

Unfortunately the bug still exists.


Previous Comments:
------------------------------------------------------------------------

[2009-04-25 14:44:51] j...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------

[2007-04-09 14:31:34] martin at bangaroo dot net

Description:
------------
Executing a prepared statement changes the type of bound parameters 
to string (Tested only with pgsql driver).

This bite me when I wanted to execute an insert statement only when 
the double value to be inserted actually changed, NULL being a 
possible value. Unfortunatly, comparing the new value with the old 
value with the !== operator didn't work, because the type-change 
made the test always evaluate to TRUE.


Reproduce code:
---------------
<?php
  $db = new PDO("pgsql:host=localhost dbname=test user=dummy");

  $db->query("CREATE TABLE test_table ( val REAL )");
  $qry = $db->prepare("INSERT INTO test_table VALUES (:val)");
  $qry->bindParam(":val",$bound_val);

  $bound_val = 5.2;
  echo "Type before execute(): ".gettype($bound_val)."\n";
  $qry->execute();
  echo "Type after execute(): ".gettype($bound_val)."\n";

  $db->query("DROP TABLE test");
?>

Expected result:
----------------
Type before execute(): double
Type after execute(): double


Actual result:
--------------
Type before execute(): double
Type after execute(): string



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41027&edit=1

Reply via email to