Bug #76917 [NEW]: Binding parameters not sending full value
| From: | ghudson at dorothylane dot com | Date: | Fri, 21 Sep 2018 20:09:01 +0000 |
| Subject: | Bug #76917 [NEW]: Binding parameters not sending full value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217189@lists.php.net to get a copy of this message | ||
From: ghudson at dorothylane dot com
Operating system: Windows Server 2012 R2 Standard
PHP version: 7.1.22
Package: ODBC related
Bug Type: Bug
Bug description:Binding parameters not sending full value
Description:
------------
Using: ODBC Driver "SQL Server native Client 11.0", SQL Server
12.0.5579.0
When using a binding parameter to pass a value into an
ENCRYPTBYPASSPHRASE statement, the value sent is consistently truncated
to only the first character. This is true for all alphanumeric inputs.
The Value field used in the example is of the type VARBINARY(80)
Test script:
---------------
$pass = "The Pa$$phrase";
$value = "1234567890123456";
$dbh = odbc_connect("Driver={SQl Server Native Client
11.0};Server=Database2;Database=Playground", "user", "password") or
die('Something went wrong while connecting to MSSQL');
$insert = odbc_prepare($dbh, "
INSERT INTO BindTests(Value)
VALUES(ENCRYPTBYPASSPHRASE('".$pass."', ?))
");
odbc_execute($insert, array($value));
// Same Results
$insert = odbc_prepare($dbh, "
INSERT INTO BindTests(Value)
VALUES(ENCRYPTBYPASSPHRASE('The Pa$$phrase', ?))
");
odbc_execute($insert, array($value));
Expected result:
----------------
SELECT ID, CAST(DECRYPTBYPASSPHRASE('The Pa$$phrase'), Value) AS
VARCHAR(40))
FROM BindTests
--------------
ID Value
1 1234567890123456
2 1234567890123456
Actual result:
--------------
SELECT ID, CAST(DECRYPTBYPASSPHRASE('The Pa$$phrase'), Value) AS
VARCHAR(40))
FROM BindTests
--------------
ID Value
1 1
2 1
--
Edit bug report at https://bugs.php.net/bug.php?id=76917&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76917&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76917&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76917&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76917&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76917&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76917&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76917&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76917&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76917&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76917&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76917&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76917&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76917&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76917&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76917&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76917&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76917&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76917&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76917&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76917&r=mysqlcfg