Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-804

Timestamp and UTCDateTime constructors should accept integers in strict types mode

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.0
    • Affects Version/s: 1.2.0-alpha2
    • Component/s: None
    • Labels:
      None
    • Environment:
      PHP 7

      The final zend_parse_parameters() calls in these functions (respecting the DateTimeInterface allowance for UTCDateTime) uses the "s" type. This causes PHP 7 to throw a TypeError if a string is not passed.

      Since union types are not available, we cannot hint for int|string and need some other way to relax the error and allow integers to be converted to strings.

      For context, the constructor argument parsing was last changed in d25e565 for PHPC-726.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: