From: jroyer at omegafi dot com
Operating system: Red Hat ES 4
PHP version: 5.0.4
PHP Bug Type: MSSQL related
Bug description: MSSQL fetches for smallmoney and money fields create large
numeric strings
Description:
------------
We are using PHP 5.0.4/Apache 2.0.54 with FreeTDS 0.63 against a SQL
Server 2000 server. When fetching money or smallmoney fields from the
database, the return value is a string of size 28 or 24 respectively.
This problem has surfaced when upgrading our web servers from 4.3.2 to
5.0.4. Version 4.3.2 behaves as expected.
I have used the php.ini-dist out of the box to produce this problem. The
configure line is as follows:
./configure \
--with-apxs2=/usr/local/apache/bin/apxs \
--enable-bcmath \
--enable-wddx \
--with-config-file-path=/etc/php4/cgi \
--with-xml \
--with-zlib \
--enable-memory-limit \
--with-sybase=/usr/local/freetds \
--enable-magic-quotes=yes \
--enable-force-cgi-redirect \
--with-gd \
--enable-gd-native-ttf \
--with-zlib-dir=/usr/include \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-cpdflib=/usr/local \
--with-ttf=/usr \
--with-mysql=/usr/include/mysql \
--with-freetype_dir=/usr/include/freetype2
Reproduce code:
---------------
mssql_connect("Server", "UserName","Password");
mssql_select_db("Database");
$sql="Select SmallMoneyField from Table";
$result = mssql_query($sql);
$row = mssql_fetch_array($result);
while ($row = mssql_fetch_array($result)) {
$data[] .= $row["SmallMoneyField"];
echo $row["TransactionAmount"];
}
echo strlen($ydata[1]) . '<br>';
Expected result:
----------------
When the code is executed I expect to see a return of a money field with a
string length equalling the number of digits (ex. "5.00" should be string
length of 4). Output of the string, when viewing the browser source,
shows a number followed by spaces.
Actual result:
--------------
For money fields I get a string length of 28, regardless of the actual
number length and a string length of 24 for smallmoney fields. Other
fields, such as text, varchar and integers behave as expected with values
matching the number of digits/characters.
--
Edit bug report at http://bugs.php.net/?id=33154&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33154&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33154&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33154&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33154&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33154&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33154&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33154&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33154&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33154&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33154&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33154&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33154&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33154&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33154&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33154&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33154&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33154&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33154&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33154&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33154&r=mysqlcfg