Bug 769632 - php-mssql retrieves weird time from DATETIME fields
Summary: php-mssql retrieves weird time from DATETIME fields
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: php
Version: 16
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Joe Orton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-21 14:30 UTC by udo.rader
Modified: 2012-09-24 08:20 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-24 08:20:34 UTC
Type: ---


Attachments (Terms of Use)

Description udo.rader 2011-12-21 14:30:50 UTC
php-mssql delivers weird time parts of DATETIME fields in the following setting:

- standard apache & mod_suphp
- untouched /etc/php.ini
- PHP option mssql.datetimeconvert=false
- at least SQL Server 2008, have not tried others

-------CUT--------
<?php
ini_set( 'mssql.datetimeconvert', false );
$dbh = mssql_pconnect( "localhost", "foo", "bar" );
mssql_select_db( "foodb", $dbh );
$query = "SELECT GETDATE() AS brokenDate";
$sth = mssql_query( $query, $dbh );
$resultArray = array();
while ( $row = mssql_fetch_assoc( $sth ) ) {
  print "brokenDate: ".$row['brokenDate']."<br>";
}
-------CUT--------

gives this in the browser:

------CUT-------
brokenDate: 2011-04-12 32641:04
------CUT-------

with mssql.datetimeconvert set to true, the browser gets this:

------CUT-------
brokenDate: Dec 21 2011 03:25:07:530PM
------CUT-------

The number "32641" always remains the same, whereas the second part "04" changes  depending on some unknown circumstance.

The same example works fine in CLI mode, however ...

Comment 1 Remi Collet 2012-09-24 05:12:37 UTC
Can you please test is problem still exists in latest 5.3.16 (or 5.3.17 in testing) ?

Comment 2 udo.rader 2012-09-24 08:20:34 UTC
the problem does not occur with newer version of the package, so closing as old.


Note You need to log in before you can comment on or make changes to this bug.