ID:               41539
 Comment by:       freddy77 at gmail dot com
 Reported By:      frode at coretrek dot com
 Status:           Assigned
 Bug Type:         MSSQL related
 Operating System: Linux and win32
 PHP Version:      5.2.3
 Assigned To:      fmk
 New Comment:

I'm a FreeTDS developer.

There was a problem with (n)text and (n)varchar(max), not with
(n)varchar (these types are blobs). For empty blobs pointer from dbdata
was NULL. I fixed the problem in CVS HEAD and 0.64 branch. You can find
cumulative post 0.64 patch at
http://freetds.sourceforge.net/post64.diff.gz, change is at
http://freetds.cvs.sourceforge.net/freetds/freetds/src/dblib/dblib.c?r1=1.244.2.3&r2=1.244.2.4
(similar change for CVS head).

bye
  freddy77


Previous Comments:
------------------------------------------------------------------------

[2007-10-19 08:43:59] frode at coretrek dot com

Is there a chance to get a fix for this in before 5.2.5?

------------------------------------------------------------------------

[2007-08-13 08:19:34] frode at coretrek dot com

Is there a chance to get a fix for this in before 5.2.4?

------------------------------------------------------------------------

[2007-06-19 05:58:41] frode at coretrek dot com

I don't get it - the patch you posted is partly already in 5.2.3, i.e.
it's already there for php_mssql_get_column_content_with_type. But not
in php_mssql_get_column_content_without_type. But that's not the real
issue here:

As I mentioned in the original submission, bug 39213 fixed the problem
for most datatypes but doesn't help for the datatype NVARCHAR(MAX).
That's because FreeTDS does not return NULL for dbdata() on an
NVARCHAR(MAX). Please, take another look at my second comment to this
bug, where I posted an ugly work-around that requires the use of
FreeTDS' underlying libTDS, which seems to be the only API that can tell
the difference between a NULL and a "" in BLOBs (which is what the
NVARCHAR(MAX) datatype basically is); the difference is that the size is
-1 for NULL values, and 0 for "" values, but the dblib API converts -1
to 0 in dbdatlen().

Thanks again for looking at this bug a second time :)

------------------------------------------------------------------------

[2007-06-18 20:27:16] erudd at netfor dot com

Isn't this a dup of #39213.

------------------------------------------------------------------------

[2007-06-18 20:16:31] erudd at netfor dot com

Patch Developed w/ freetds maintainer to fix this issue

--- mssql/php_mssql.c.orig      2006-04-04 14:49:12.000000000 -0400
+++ mssql/php_mssql.c   2006-10-24 16:41:18.000000000 -0400
@@ -818,7 +818,7 @@
 
 static void php_mssql_get_column_content_with_type(mssql_link
*mssql_ptr,int offset,zval *result, int column_type  TSRMLS_DC)
 {
-       if (dbdatlen(mssql_ptr->link,offset) == 0) {
+       if (dbdatlen(mssql_ptr->link,offset) == 0 &&
dbdata(mssql_ptr->link,offset) == NULL) {
                ZVAL_NULL(result);
                return;
        }
@@ -941,7 +941,7 @@
 
 static void php_mssql_get_column_content_without_type(mssql_link
*mssql_ptr,int offset,zval *result, int column_type TSRMLS_DC)
 {
-       if (dbdatlen(mssql_ptr->link,offset) == 0) {
+       if (dbdatlen(mssql_ptr->link,offset) == 0 &&
dbdata(mssql_ptr->link,offset) == NULL) {
                ZVAL_NULL(result);
                return;
        }

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/41539

-- 
Edit this bug report at http://bugs.php.net/?id=41539&edit=1

Reply via email to