From:             alan dot trick at twu dot ca
Operating system: Linux
PHP version:      5.2.4
PHP Bug Type:     MSSQL related
Bug description:  NULL == '' for ntext and nvarchar(max)

Description:
------------
This bug is somewhat related to #39213 except it only occurs (as far as I
can tell) on fields that are ntext and nvarchar(max). The Moodle bug report
MDL-11810 (http://tracker.moodle.org/browse/MDL-11810) has more info. This
is with freeTDS.

Reproduce code:
---------------
$tables = array(
    'nulltest' => 'varchar(5)',
    'nulltestnvar' => 'nvarchar(5)',
    'nulltestntext' => 'ntext',
    'nulltestnvarmax' => 'nvarchar(max)'
);
foreach($tables as $table=>$domain) {
    print "==$table==\n";
    mssql_query("create table $table (test $domain);");
    mssql_query("insert into $table values('');");
    $r = mssql_query("select * from $table;");
    while ($a = mssql_fetch_assoc($r)) var_dump($a['test']);
    mssql_query("drop table $table;");
}

Expected result:
----------------
==nulltest==
string(0) ""
==nulltestnvar==
string(0) ""
==nulltestntext==
string(0) ""
==nulltestnvarmax==
string(0) ""

Actual result:
--------------
==nulltest==
string(0) ""
==nulltestnvar==
string(0) ""
==nulltestntext==
NULL
==nulltestnvarmax==
NULL

-- 
Edit bug report at http://bugs.php.net/?id=43043&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43043&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43043&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43043&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43043&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43043&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43043&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43043&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43043&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43043&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43043&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43043&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43043&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43043&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43043&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43043&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43043&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43043&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43043&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43043&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43043&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43043&r=mysqlcfg

Reply via email to