Skip to content

IntlDateFormatter crashes (SIGSEGV) when dateType is outside expected range #12243

Closed

Description

@mrblur

Description

The following code:

<?php

$datetime = new \DateTime('2017-05-12 23:11:00 GMT+2');

$formatter = new IntlDateFormatter(
	locale: 'en',
	dateType: -2,
	timeType: 0,
	timezone: $datetime->getTimezone(),
);

var_dump($formatter->format($datetime));

Resulted in this output:

SIGSEGV

But I expected this output instead:

false

PHP Version

PHP 8.1.22

Operating System

No response

Activity

  1. changed the title [-]IntlDateFormatter crashes (SIGSEGV) when dateType is outside recognized range[/-] [+]IntlDateFormatter crashes (SIGSEGV) when dateType is outside expected range[/+] on Sep 19, 2023
  2. devnexen commented on Sep 19, 2023

    @devnexen
    Member

    Seems to me that since UDAT_PATTERN is passed (-2) for dateType, timeType needs to be too, but I ll have a better look later.

  3. self-assigned this
    on Sep 19, 2023
  4. added a commit that references this issue on Sep 20, 2023
    2f9d3f9
  5. added a commit that references this issue on Jan 31, 2024
    84c4336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions