#25544 [Ver->Bgs]: Only 255 characters returned from varchar field

From: Date: Tue, 16 Sep 2003 09:35:29 +0000
Subject: #25544 [Ver->Bgs]: Only 255 characters returned from varchar field
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-47622@lists.php.net to get a copy of this message
ID: 25544 Updated by: abies@php.net Reported By: snick at getart dot ru -Status: Verified +Status: Bogus Bug Type: MSSQL related Operating System: Windows 2003 Server PHP Version: 4.3.2 Assigned To: abies New Comment: Ilia, this is probably what you meant in the first place, but I'll elaborate a little more: MS SQL support on Win32 is implemented using the DbLib C API by Microsoft, which has this limitation. Use TEXT fields instead. Previous Comments: ------------------------------------------------------------------------ [2003-09-16 03:55:28] abies@php.net Don't think so ... He's using Microsoft SQL Server, which has VARCHAR fields of up to 8000 characters (or bytes, not sure) I'll have a look at this ... ------------------------------------------------------------------------ [2003-09-15 18:30:56] iliaa@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. You're dealing with VARCHAR maximum length limitation of 255 characters. This is not a PHP bug. ------------------------------------------------------------------------ [2003-09-15 09:37:12] snick at getart dot ru Description: ------------ Then I try to read value of VARCHAR field I get only 255 characters, but VARCHAR is 8000 bytes long. MSSQL v. 7.0 ntwdblib.dll v. 2000.80.194.0 PHP v. 4.3.2 Apache v. 2.0.43 / IIS 6 Reproduce code: --------------- $myVar = str_repeat("*", 500); mssql_query("DELETE FROM myTable"); mssql_query("INSERT INTO myTable (myField) VALUES ('".$myVar."')"); $query = "SELECT LEN(myField), myField FROM myTable"; list($realLength, $myVar) = mssql_fetch_row(mssql_query($query)); echo "DB length: ".$realLength."; PHP length: ".strlen($myVar); Expected result: ---------------- $myVar must be equal $realLength Actual result: -------------- strlen($myVar) == 255 (always) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25544&edit=1

« previous php.bugs (#47622) next »