I'm using an ODBC connection to retrieve data on a Windows Server. After upgrading PHP from 5.4 to 5.6 (as well as on 5.5) all varchar fields seem to be returning random uninitialized memory, although the string length does match that of the field being queried.
For example, a query returning the string "Test.txt" in 5.4 returns the following in 5.5+:
I've compared my php.ini
settings between the two versions and they seem to be identical in terms of what's being specific related to charsets and ODBC settings.
I can run both versions side by side on the same ODBC resource at the same time and get these results. Non-varchar fields like dates and integers are printing correctly. I'm simply running the x86 thread safe php.exe
executable downloaded from http://windows.php.net/download for 5.4, 5.5, and 5.6.
What else can I configure to try and resolve this?
Edit: I'm using the Unified ODBC functions like so:
$o = odbc_connect("Driver=MMODBC;Server=localhost;Database=odbc_mapping;", [user], [pass]);
$r = odbc_exec($o, "SELECT * FROM Table");
while (odbc_fetch_row($r)) {
print odbc_result($r, 1);
}
There are a handful of bugs at http://bugs.php.net related to uninitialized data appearing in odbc function results. They are primarily for older (e.g. 5.3) versions of php. That appears to be what's happening in this case, or some variant therein.
Switching to PDO in 5.6 has completely resolved the issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With