Skip to content

Fatal error on DateTimeImmutable::createFromInterface #401

@yann-eugone

Description

@yann-eugone

Very similar of #295

$ php -v
PHP 8.1.2-1ubuntu2.9 (cli) (built: Oct 19 2022 14:58:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.9, Copyright (c), by Zend Technologies
$date = new \DateTime();
$immutable = \Safe\DateTimeImmutable::createFromInterface($date);
Error: Call to a member function format() on null

/home/yann/workspace/oss/safe/lib/DateTimeImmutable.php:71

I believe we are missing a wrapper around this method too
https://www.php.net/manual/en/datetime.createfrominterface.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions