From:             baldurien at bbnwn dot eu
Operating system: Irrelevant
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  What is the default type of bindParam(), bindValue() and 
execute(array) ? (PDO)

Description:
------------
I was wondering what is the default type of parameter when none is set? 

Reproduce code:
---------------
If I run that code :

$dbh = new PDO(
  'mysql:host=localhost;dbname=xxx', 'xxx', 'xxx');
$stmt = $dbh->prepare('SELECT ? FROM DUAL WHERE 1 = ?');

var_dump($stmt->execute(array('aa\'aa', 'aaa')));

This dump true, meaning that 'aaa' was casted to a string and that the
actual query looks like this in mySQL :

SELECT 'aa''aa' FROM DUAL WHERE 1 = 'aaa'

Expected result:
----------------
The documentation should indicate that when no type is provided (while
calling bindParam(), bindValue(), or execute()), PDO::PARAM_STRING is
used. 

Actual result:
--------------
Neither bindParam(), bindValue() or execute() speak of a default type, nor
the main page of PDO (http://fr.php.net/manual/en/ref.pdo.php) describe it.
Thus, we could expect anything from the driver (like casting variable into
integer instead of string).

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

Reply via email to