Skip to Content.
Sympa Menu

freetds - Re: [freetds] Segmentation fault retrieving non-NULL datetime fields

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Segmentation fault retrieving non-NULL datetime fields
  • Date: Sat, 5 Nov 2005 10:55:23 -0500

Robert Benjamin wrote:
> I am using freetds 0.63 with php 4.4.1. I have a simple script which
> executes the query
>
> "SELECT [DateModified] FROM PEOPLE WHERE LastName LIKE '%Smith%'
>
>
> When fetching the data with the code
>
> while ($row = $rs->fetchRow(DB_FETCHMODE_ASSOC))
> {
> print "Date modified is " . $row["DateModified"] . "\n" ;
> }
>
> if the DateModified is _not_ NULL, I get a segmentation fault.

The form of the default datetime->character conversion has been carefully
set to mimic that of the vendors' libraries. I think if you get a
backtrace in gdb for your simple script, you'll find the culprit is
somewhere in the PHP code.

FreeTDS transports your datetime field in its native format, and PHP
converts it to a character string. The conversion may be implicit
(dbbind) or explicit (dbconvert); I don't know. Regardless, it's
certainly an opportunity to fail to allocate enough memory for the
conversion, which is certainly one route to a segmentation fault.

HTH.

--jkl

--




Archive powered by MHonArc 2.6.24.

Top of Page