1--TEST-- 2Bug #73448 odbc_errormsg returns trash, always 513 bytes 3--EXTENSIONS-- 4odbc 5--SKIPIF-- 6<?php include 'skipif.inc'; ?> 7--CONFLICTS-- 8odbc 9--FILE-- 10<?php 11 12include 'config.inc'; 13 14$conn = odbc_connect($dsn, $user, $pass); 15 16$sqlCommandList = array( 17 "/* empty batch is without error */", 18 "/* non existent procedure xy */ execute xy", 19 "/* empty batch,error message is not empty */", 20 "/* valid select with result */ select * from sys.sysobjects", 21 "/* another erroneous query */ SELECT * FROM zwiebelfleisch", 22 "/* valid select with result */ select * from sys.sysobjects", 23); 24 25foreach ($sqlCommandList as $exampleNumber => $sql) { 26 $r = @odbc_exec($conn, $sql); 27 28 if (false === $r) { 29 $e = odbc_errormsg($conn); 30 $n = odbc_error($conn); 31 32 var_dump($sql, $n, $e); 33 echo "\n"; 34 } 35 36 if ($r) { 37 odbc_free_result($r); 38 } 39 40} 41 42odbc_close($conn); 43?> 44--EXPECTF-- 45string(42) "/* non existent procedure xy */ execute xy" 46string(5) "37000" 47string(%d) "[Microsoft][%s][SQL Server]Could not find stored procedure 'xy'." 48 49string(58) "/* another erroneous query */ SELECT * FROM zwiebelfleisch" 50string(5) "S0002" 51string(%d) "[Microsoft][%s][SQL Server]Invalid object name 'zwiebelfleisch'." 52 53