|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43043 NULL == '' for ntext and nvarchar(max)
Submitted: 2007-10-19 18:51 UTC Modified: 2007-10-21 15:30 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: alan dot trick at twu dot ca Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: alan dot trick at twu dot ca
New email:
PHP Version: OS:


 [2007-10-19 18:51 UTC] alan dot trick at twu dot ca
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 ( 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:
string(0) ""
string(0) ""
string(0) ""
string(0) ""

Actual result:
string(0) ""
string(0) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-19 21:47 UTC] felipensp at gmail dot com
This isn't a bug.
Check the configuration options mssql.textlimit and mssql.textsize.
 [2007-10-19 21:59 UTC] alan dot trick at twu dot ca
Why would that have anything do do with anything? Aren't those just limits on the maximum amount of text that can come through?

My values in php.ini are:

mssql.textlimit = 20971520
mssql.textsize = 20971520

I had to set it because mssql was cropping some of my long text fields.
 [2007-10-21 15:30 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

See comments for previous bugs on this issue.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon May 29 19:03:42 2023 UTC