Bug #75937 [NEW]: PDO_DBLIB prepare statements quoting numerics

From: Date: Thu, 08 Feb 2018 18:21:59 +0000
Subject: Bug #75937 [NEW]: PDO_DBLIB prepare statements quoting numerics
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213868@lists.php.net to get a copy of this message
From: equaproduction at gmail dot com Operating system: Centos 7.2 PHP version: 7.2.2 Package: PDO DBlib Bug Type: Bug Bug description:PDO_DBLIB prepare statements quoting numerics Description: ------------ When using PDO_DBLIB to prepare statements, numerics are quoted and fatal error is returned. PDOStatement::bindValue() PDOStatement::bindParam() OS : Centos 7.2 PHP : 7.2.2 Freetds : 0.95.81 DBMS : Sybase ASE 12.5.4 & Sybase ASE 16.0 Test script: --------------- // create table foo ( n numeric(14,2) null ) $db = new \PDO("dblib:host=$hostname:$port;dbname=$dbname", "$username", "$pw"); $db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $n = 123.45; $query = 'INSERT INTO foo ( n ) values ( :n )'; $stmt = $db->prepare($query); $stmt->bindParam(':n', $n, \PDO::PARAM_STR); $stmt->execute(); Actual result: -------------- SQLSTATE[HY000]: General error: 20018 Implicit conversion from datatype 'VARCHAR' to 'NUMERIC' is not allowed. Use the CONVERT function to run this query. [20018] (severity 16) [INSERT INTO foo ( n ) values ( '123.45' )] -- Edit bug report at https://bugs.php.net/bug.php?id=75937&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75937&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75937&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75937&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75937&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75937&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75937&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75937&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75937&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75937&r=support Expected behavior: https://bugs.php.net/fix.php?id=75937&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75937&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75937&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75937&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75937&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75937&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75937&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75937&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75937&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75937&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75937&r=mysqlcfg

« previous php.bugs (#213868) next »