|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-11-07 19:23 UTC] ab@php.net
[2016-11-07 19:23 UTC] ab@php.net
-Status: Open
+Status: Closed
[2016-11-07 20:01 UTC] ab@php.net
-Assigned To:
+Assigned To: ab
[2016-11-07 20:01 UTC] ab@php.net
[2016-11-07 20:57 UTC] honza dot hink at gmail dot com
[2016-11-08 12:30 UTC] ab@php.net
[2016-11-09 03:33 UTC] krakjoe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 02:00:02 2025 UTC |
Description: ------------ If odbc_exec returns false then odbc_errormsg returns always 513 bytes in my examples. The correct error message is at the beginning, then some null bytes follows and the rest is binary trash. If next odbc_exec is OK then odbc_errormsg returns similar content as before, the trash may be different. It doesn't return empty string as written in documentation. The example (19 lines) can be used as simple page (like index.php). It contains 4 SQL commands and displays error text in raw and hexadecimal form. Adjust parameters in odbc_connect. The bug appears in ODBC with MS SQL 2008, 2012, probably all versions, Apache/2.4.17 (Win32) or IIS 7, FCGI mode, mod_fcgid/2.3.9. First noticed several months ago, problem probably started with 7.0.0. Test script: --------------- <?php $con=odbc_connect("MSSQLLocal","sa","your-pwd"); $sqlCommandList=array("/* empty batch is without error */","/* non existent procedure xy */ execute xy", "/* empty batch, error message is not empty */","/* valid select with result */ select * from sys.sysobjects"); foreach($sqlCommandList as $exampleNumber=>$sql){ $r = @odbc_exec($con,$sql); $exampleNumber++; if($r) {$numfields="Result = $r, field count = ".odbc_num_fields($r); odbc_free_result($r);} else {$numfields="Invalid result";} $e=odbc_errormsg($con); $hex=bin2hex($e); print "<hr style=height:5px; color=red><br><div style=font-width:bold>Example $exampleNumber SQL = $sql</div> <div>$numfields, error text(length=".strlen($e)."): </div> <div><pre>$e</pre></div><hr> <div style=font-weight:bold>Hexadecimal error content:</div> <div style=word-wrap:break-word;max-width:600px>$hex</div>"; }