Google-cloud-php: Spanner: \Google\Cloud\Spanner\Timestamp::formatAsString() with zero padding

Created on 13 Mar 2018  路  2Comments  路  Source: googleapis/google-cloud-php

We have found a following behavior on \Google\Cloud\Spanner\Timestamp::formatAsString()
Is this correct?

Code

$conn = $this->getSpannerConnection();
$row = $conn->getSpannerDatabase()->execute('SELECT TIMESTAMP("2018-03-13T16:40:12.300000Z")')->rows()->current();
/** @var Timestamp $ts */
$ts = $row[0];
$this->assertEquals('2018-03-13T16:40:12.300000Z', $ts->formatAsString());

Result

Failed asserting that two strings are equal.
Expected :'2018-03-13T16:40:12.300000Z'
Actual   :'2018-03-13T16:40:12.000003Z'

Environment

  • PHP 7.1.12
  • PHP Spanner Client Library version: google/cloud-spanner v1.2.0
  • gRPC extension: v1.9.0
spanner p1 bug

Most helpful comment

@castaneai, thanks for the report. I'll work on getting this resolved.

All 2 comments

@castaneai, thanks for the report. I'll work on getting this resolved.

This has been fixed in v0.62.0.

Was this page helpful?
0 / 5 - 0 ratings