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

From: Date: Tue, 16 Sep 2003 07:55:28 +0000
Subject: #25544 [Bgs->Opn]: Only 255 characters returned from varchar field
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-47615@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: Bogus +Status: Open Bug Type: MSSQL related Operating System: Windows 2003 Server PHP Version: 4.3.2 -Assigned To: +Assigned To: abies New Comment: 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 ... Previous Comments: ------------------------------------------------------------------------ [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 (#47615) next »