xref: /PHP-7.3/ext/date/tests/bug62500.phpt (revision bcf5853e)
1--TEST--
2Bug #62500 (Segfault in DateInterval class when extended)
3--INI--
4date.timezone=GMT
5--FILE--
6<?php
7class Crasher extends DateInterval {
8    public $foo;
9    public function __construct($time_spec) {
10        var_dump($this->foo);
11        $this->foo = 3;
12        var_dump($this->foo);
13        var_dump($this->{2});
14        parent::__construct($time_spec);
15    }
16}
17try {
18    $c = new Crasher('blah');
19} catch (Exception $e) {
20    var_dump($e->getMessage());
21}
22--EXPECTF--
23NULL
24int(3)
25
26Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d
27NULL
28string(%s) "DateInterval::__construct(): Unknown or bad format (blah)"
29