php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40986 mssql_field_name() retrieves only first 30 characters
Submitted: 2007-04-03 17:43 UTC Modified: 2007-04-11 16:23 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Arne dot Heizmann at csr dot com Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.2.1 OS: Windows 2000
Private report: No CVE-ID: None
 [2007-04-03 17:43 UTC] Arne dot Heizmann at csr dot com
Description:
------------
The function mssql_field_name() appears to return only the first 30 characters of the field name.

Reproduce code:
---------------
<?
    $sql = 'select 1 as [This is a field name that is longer than 30 characters]';
    $mssqlh = mssql_pconnect ('server', 'username', 'password');    // change as appropriate
    mssql_select_db ('databasename', $mssqlh);                      // change as appropriate
    $result = mssql_query ($sql, $mssqlh);
    $fieldname = mssql_field_name ($result, 0);
    var_export ($fieldname);
?>

Expected result:
----------------
'This is a field name that is longer than 30 characters'

Actual result:
--------------
'This is a field name that is l'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-03 22:08 UTC] fmk@php.net
This is a limit in the MSSQL library (ntwdblib.dll) used to build the extension. Use the php_dblib.dll version of the extension. This version is build with FreeTDS and does not have these limitations.

This has been reported many times before. Please search the archives before posting the same bugs over and over.
 [2007-04-11 08:42 UTC] Arne dot Heizmann at csr dot com
If using another DLL solves the problem, then clearly the mssql_*() functions should use it and not something buggy. If this problem is known, why is PHP still shipped with it?
 [2007-04-11 08:44 UTC] Arne dot Heizmann at csr dot com
(reopening, see above comment)
 [2007-04-11 14:00 UTC] tony2001@php.net
.
 [2007-04-11 16:23 UTC] Arne dot Heizmann at csr dot com
So much for the user-/customer-friendliness of PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 03:01:27 2024 UTC