#26315 [Com]: mssql_fectch_* functions are returning a space char on empty fields
ID: 26315 Comment by: php at electricsurfer dot com Reported By: webmaster at cbre dot fr Status: Bogus Bug Type: MSSQL related Operating System: Windows 2000 Server PHP Version: 4.3.4 New Comment: THIS IS A BUG new to 4.3.4. Introduced by removing the auto-trimming While the change is a good one, if '' is in the DB, mssql_fetch_* should NOT return ' ' IN DB: '' (empty string) Returned by mssql_fetch_assoc(): ' ' (single space) Previous Comments: [2003-11-21 11:33:13] jabberwocky at ibplanet dot com also, instead of returning 0 it is now also returning a space if there is a 0 in the DB [2003-11-21 07:56:06] w1lz0r at barrysworld dot net This is a bug, as there is no space in the database. The change from not auto-trimming is a good one IMO, but the behaviour of empty fields is different now. Any character field which is empty (e.g. '') and not null will be returned as a space. My application no longer worked correctly after the 4.3.4 change and I have to now manually do (if ($field==' ') $field='';). This is a major change from previous versions and a bug as the mssql functions should return what is IN the database. Maybe this is the reason why the rtrim was done in the past? Please re-evaluate. [2003-11-19 09:42:17] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php mssql extension no longer automatically trims varchar fields [2003-11-19 07:20:52] webmaster at cbre dot fr Description: mssql_fectch_* functions are returning a space char when selecting empty fields. The problem does not occur where MSSQL table fields are set to value insteed of empty. It was not working this way with PHP 4.3.2 and previous versions. I can't see nothing in the change log about this. Kind regards Clement -- Edit this bug report at http://bugs.php.net/?id=26315&edit=1
#10824 [Com]: does not return more than 256 chars from a varchar
ID: 10824 Comment by: php at electricsurfer dot com Reported By: sysadminnospam at cheezy dot net Status: Closed Bug Type: MSSQL related Operating System: MS Windows 2000 PHP Version: 4.0.4pl1 New Comment: There's an easier workaround: SELECT CAST(F AS TEXT) AS F FROM ... No other changes ! Previous Comments: [2003-02-24 06:41:34] magne at myrtveit dot com Here is a workaround that I have used with success. When returning a VARCHAR field F that can exceed 256 characters, I return several computed fields F1, F2, etc using the following SQL query syntax: SELECT ("<" + SUBSTRING(F, 1, 253) + ">") AS F1 , ("<" + SUBSTRING(F, 254, 253) + ">") AS F2 , ("<" + SUBSTRING(F, 507, 253) + ">") AS F3 FROM ... In my PHP code i put F1, F2, F3 together after removing the enclosing <> (which I put on in order to maintain white space at either end of each Fi): $F = substr($F1, 1, -1) . substr($F2, 1, -1) . substr($F3, 1, -1); Good luck! Magne [2001-06-30 14:36:30] [EMAIL PROTECTED] This is not a bug in the php extension. The library used to connect to SQL Server soes not allow warchar columns to be more that 255 char. [2001-05-11 23:40:22] sysadminnospam at cheezy dot net Problem: Queries and stored procedures returning varchar data do not return more than 256 chars. The rest is truncated. Affected functions: MSSQL_FETCH_OBJECT MSSQL_FETCH_ARRAY MSSQL_FETCH_ROW (didn't get opportunity to test, but seems likely) I know there was an earlier report similar to this in regards to NCHAR, however, varchar has nothing to do with unicode. Are we looking at the same problem here anyways? Any idea on how long 'til a solution, or some sort of work-around? Using datatype TEXT is NOT an option -- it puts too much overhead on transactions. Since this was classified as a Microsoft problem, I guess upgrading to 4.0.5 would not help, huh? Thanks. -- Edit this bug report at http://bugs.php.net/?id=10824&edit=1
#25544 [Com]: Only 255 characters returned from varchar field
ID: 25544 Comment by: php at electricsurfer dot com Reported By: snick at getart dot ru Status: Bogus Bug Type: MSSQL related Operating System: Windows 2003 Server PHP Version: 4.3.2 Assigned To: abies New Comment: There's an easy workaround: SELECT CAST(F AS TEXT) AS F FROM ... No other changes ! Previous Comments: [2003-09-16 05:35:29] [EMAIL PROTECTED] 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. [2003-09-16 03:55:28] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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
#23990 [NEW]: mssql_fetch_assoc does not support long column names
From: php at electricsurfer dot com Operating system: Win XP PRO PHP version: 4.3.2 PHP Bug Type: MSSQL related Bug description: mssql_fetch_assoc does not support long column names If you select a field with a column name that has more than 30 chars. Using mssql_fetch_assoc or mssql_fetch_row to fetch it will only return a key with the 1st 30 chars. ( Mysql functions work with longer column names ) 50) (only first 30 chars in key) ?> -- Edit bug report at http://bugs.php.net/?id=23990&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23990&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23990&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23990&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23990&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23990&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=23990&r=support Expected behavior: http://bugs.php.net/fix.php?id=23990&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=23990&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=23990&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23990&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23990&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23990&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23990&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=23990&r=gnused
#23990 [Opn]: mssql_fetch_assoc does not support long column names
ID: 23990 User updated by: php at electricsurfer dot com Reported By: php at electricsurfer dot com Status: Open Bug Type: MSSQL related Operating System: Win XP PRO PHP Version: 4.3.2 New Comment: with mssql_fetch_assoc or mssql_fetch_array. NOT mssql_fetch_row. Previous Comments: [2003-06-03 11:29:50] php at electricsurfer dot com If you select a field with a column name that has more than 30 chars. Using mssql_fetch_assoc or mssql_fetch_row to fetch it will only return a key with the 1st 30 chars. ( Mysql functions work with longer column names ) 50) (only first 30 chars in key) ?> -- Edit this bug report at http://bugs.php.net/?id=23990&edit=1
#23990 [Opn]: mssql_fetch_assoc does not support long column names
ID: 23990 User updated by: php at electricsurfer dot com Reported By: php at electricsurfer dot com Status: Open Bug Type: MSSQL related Operating System: Win XP PRO PHP Version: 4.3.2 New Comment: mssql_field_name() has same problem Previous Comments: [2003-06-03 11:41:35] php at electricsurfer dot com with mssql_fetch_assoc or mssql_fetch_array. NOT mssql_fetch_row. [2003-06-03 11:29:50] php at electricsurfer dot com If you select a field with a column name that has more than 30 chars. Using mssql_fetch_assoc or mssql_fetch_row to fetch it will only return a key with the 1st 30 chars. ( Mysql functions work with longer column names ) 50) (only first 30 chars in key) ?> -- Edit this bug report at http://bugs.php.net/?id=23990&edit=1
#23990 [Opn]: mssql_fetch_assoc does not support long column names
ID: 23990 User updated by: php at electricsurfer dot com Reported By: php at electricsurfer dot com Status: Open Bug Type: MSSQL related Operating System: Win XP PRO PHP Version: 4.3.2 New Comment: Just found bug #20810 which coincides with this one. mssql_fetch_field() also has the same problem. Previous Comments: [2003-06-03 12:16:49] php at electricsurfer dot com mssql_field_name() has same problem [2003-06-03 11:41:35] php at electricsurfer dot com with mssql_fetch_assoc or mssql_fetch_array. NOT mssql_fetch_row. [2003-06-03 11:29:50] php at electricsurfer dot com If you select a field with a column name that has more than 30 chars. Using mssql_fetch_assoc or mssql_fetch_row to fetch it will only return a key with the 1st 30 chars. ( Mysql functions work with longer column names ) 50) (only first 30 chars in key) ?> -- Edit this bug report at http://bugs.php.net/?id=23990&edit=1
#24153 [NEW]: Use default parameters in the middle while overriding def parameters at the end
From: php at electricsurfer dot com Operating system: WIN XP PHP version: 4.3.2 PHP Bug Type: Feature/Change Request Bug description: Use default parameters in the middle while overriding def parameters at the end Description: Given: It would be nice to be able to do this: Which would keep the default values for arguments 3 & 5 but specify a value for argument 4. This way, if I ever change the default value of $arg3 from '' to null, I have less code to modify. -- Edit bug report at http://bugs.php.net/?id=24153&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24153&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24153&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24153&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24153&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24153&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=24153&r=support Expected behavior: http://bugs.php.net/fix.php?id=24153&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=24153&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=24153&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24153&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24153&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24153&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24153&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=24153&r=gnused
#24258 [NEW]: array_keys 3rd parameter: strict
From: php at electricsurfer dot com Operating system: Win XP PHP version: 4.3.2 PHP Bug Type: Feature/Change Request Bug description: array_keys 3rd parameter: strict Description: array_keys() would benefit from an optional 3rd parameter called $strict. array_keys(array input [, mixed search_value [, bool strict]])) . This is similar to what in_array() has. If set to true it would return an array of keys where value_for_key===search_value. (not only ==search_value) -- Edit bug report at http://bugs.php.net/?id=24258&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24258&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24258&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24258&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24258&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24258&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=24258&r=support Expected behavior: http://bugs.php.net/fix.php?id=24258&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=24258&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=24258&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24258&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24258&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24258&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24258&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=24258&r=gnused