From:             akie at gods dot ru
Operating system: RedHat9 (linux 2.4.18)
PHP version:      4.3.4
PHP Bug Type:     MSSQL related
Bug description:  spaces at the end of values from DB

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 bug report at http://bugs.php.net/?id=27131&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27131&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27131&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27131&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27131&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27131&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27131&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27131&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27131&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27131&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27131&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27131&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27131&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27131&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27131&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27131&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27131&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27131&r=float

Reply via email to