#27131 [Opn]: spaces at the end of values from DB

From: Date: Tue, 03 Feb 2004 14:14:56 +0000
Subject: #27131 [Opn]: spaces at the end of values from DB
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-54323@lists.php.net to get a copy of this message
ID: 27131 User updated by: akie at gods dot ru Reported By: akie at gods dot ru Status: Open Bug Type: MSSQL related Operating System: RedHat9 (linux 2.4.18) PHP Version: 4.3.4 New Comment: Sorry, freetds 0.62 (tds version = 7.0) Previous Comments: ------------------------------------------------------------------------ [2004-02-03 09:06:15] akie at gods dot ru Description: ------------ After fixing this bug: ---- Fixed bug 25777 (Do not rtrim() of text fields fetched from mssql). (Ilia) ---- problems arose. For some field in database (not necessarily varchar!), in PHP we obtain the values with whitespaces at the ends. This produse incorrect results/ Configurations: MS SQL Server 7.0 on Windows 2000 Advanced Server PHP4.3.4 on RedHat9 Linux with freetds 7.0 This problem has been observed after updating PHP (4.3.3=>4.3.4) at www.stereo.ru and www.mobil.ru (many scripts started to work incorrectly and it was necessary to trim even number fields..) Reproduce code: --------------- [ MS SQL ] CREATE TABLE test(id int NOT NULL, field tinyint NOT NULL) INSERT INTO test(id, field) VALUES(1, 0) INSERT INTO test(id, field) VALUES(2, 1) CREATE PROCEDURE test_GetList AS SELECT id, field FROM test GO [ PHP ] $con = sybase_connect("sqldev", "web_guest", "guest_web"); sybase_select_db($db); $res = sybase_query("exec test_GetList", $con); while ($obj = sybase_fetch_object($res)) { echo ">>".$obj->field."<<\n"; } Expected result: ---------------- >>0<< >>1<< Actual result: -------------- >>0_<< >>1_<< (here "_" means space symbol) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27131&edit=1

« previous php.bugs (#54323) next »