Edit report at http://bugs.php.net/bug.php?id=51213&edit=1

 ID:                 51213
 Comment by:         rgagnon24 at gmail dot com
 Reported by:        alexr at oplot dot com
 Summary:            pdo_mssql is trimming value of the money column
 Status:             Closed
 Type:               Bug
 Package:            PDO related
 Operating System:   Windows
 PHP Version:        5.2.13
 Assigned To:        iliaa
 Block user comment: N

 New Comment:

New bug opened as bug 52546 to deal with this new issue.


Previous Comments:
------------------------------------------------------------------------
[2010-08-05 21:48:31] rgagnon24 at gmail dot com

This closed bug which was recently made part of the 5.2.14 release
causes segmentation fault when a money type is fetched.



The patch supplied "pdo_mssql_money_column_conversion_fix" "last
revision 2010-03-05 09:38 UTC" works, but the committed code does not.



The spprintf() call is the cause of the segmentation fault as it is
sending incompatible pointer val->data as parameter 1 which appears to
be uninitialized pointer.  (val->data was never emalloc'd) 



Anyone using pdo_dblib will get a seg fault attempting to iterate
results with money results.

------------------------------------------------------------------------
[2010-03-08 13:39:53] il...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2010-03-08 13:39:46] il...@php.net

Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=295958
Log: Fixed bug #51213 (pdo_mssql is trimming value of the money column).

------------------------------------------------------------------------
[2010-03-05 10:36:45] alexr at oplot dot com

Description:
------------
Money column is wrongly converting to the char column and this cause
that value is rounding to the 2 digits after delimiter (dot).

Test script:
---------------
$dsn = 'mssql:dbname=DBNAME;host=HOSTNAME';

$user = 'USERNAME';

$password='PASSWORD';

$dbh = new PDO($dsn, $user, $password);

$sth = $dbh->query  ('create table #tmp(col money)');

$sth = $dbh->query  ('insert into #tmp(col) values(-0.1234)');

$sth = $dbh->query  ('insert into #tmp(col) values(0.1234)');

$sth = $dbh->prepare('select * from #tmp');

$sth->execute();

$r = $sth->fetchAll(2);

print_r($r);

Expected result:
----------------
Array

(

    [0] => Array

        (

            [col] => -0.1234

        )



    [1] => Array

        (

            [col] => 0.1234

        )



)

Actual result:
--------------
Array

(

    [0] => Array

        (

            [col] => -0.12

        )



    [1] => Array

        (

            [col] => 0.12

        )



)


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51213&edit=1

Reply via email to