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