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