Skip to Content.
Sympa Menu

freetds - PHP's mssql_fetch_row inserting '\0' on strings?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Andre Costa <brblueser AT uol.com.br>
  • To: FreeTDS ML <freetds AT franklin.metalab.unc.edu>
  • Subject: PHP's mssql_fetch_row inserting '\0' on strings?
  • Date: Tue, 18 Jun 2002 21:17:45 -0300


Hi all,

[config info: FreeTDS 0.53 compiled with gcc-3.1 on Linux RH 7.1, PHP
4.0.6, MS-SQL Sever 7.0 on Win2000, protocol version 7.0]

my queries are returning some bogus '\0' on text fields. This is, of
course, causing havoc on my PHP program...

For example, a result that should come as

Academias

comes as

Academias\000\000\000\000\000\000\000\000\000

The number of '\0's varies, and sometimes there is garbage (i.e. other
chars) among them. Using protocol version 4.2 produces the right output
(i.e. no embedded \0s, but I am affraid I will need 7.0 features such as
longer strings capacity).

<wild guess> The first \0 always happens at the right place, i.e. the
string should indeed end there. It looks as if freeTDS is returning a
valid C string (i.e. with a C string terminator on the right place), but
something is happening when this string is translated into a PHP
string.</wild guess>

I have tried both the freetds-0.53 tarball and the current snapshot. The
behavior is the same.

(I am sure this was a pitiful report, but my head had stopped producing
coherent thoughts a couple of hours ago, gotta go home to take some
rest...)

If anyone has any clue about this, please, let me know. It will be much
appreciated.

TIA

Best,

Andre




Archive powered by MHonArc 2.6.24.

Top of Page