php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27131 spaces at the end of values from DB
Submitted: 2004-02-03 09:06 UTC Modified: 2004-02-03 10:23 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: akie at gods dot ru Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.3.4 OS: RedHat9 (linux 2.4.18)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: akie at gods dot ru
New email:
PHP Version: OS:

 

 [2004-02-03 09:06 UTC] 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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-03 09:14 UTC] akie at gods dot ru
Sorry, freetds 0.62 (tds version = 7.0)
 [2004-02-03 09:32 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Search before submit!

 [2004-02-03 09:55 UTC] akie at gods dot ru
Maybe I am blind, but I can't find bug report with the similar problem..
Or you mean that this problem is solved already?
 [2004-02-03 10:05 UTC] sniper@php.net
See bug #25777


 [2004-02-03 10:10 UTC] akie at gods dot ru
Oh, thank you!

Did you actually read my bug report?
 [2004-02-03 10:23 UTC] akie at gods dot ru
Sorry for disturbance, I understand..
Waiting return od rtrim in sybase functions :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 02:01:30 2024 UTC