Bug 769632

Summary: php-mssql retrieves weird time from DATETIME fields
Product: [Fedora] Fedora Reporter: udo.rader
Component: phpAssignee: Joe Orton <jorton>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: christof, fedora, guillaume, jorton, rcollet, rpm
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-24 08:20:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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.