xref: /PHP-8.0/ext/date/tests/bug62500.phpt (revision 7aacc705)
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?>
23--EXPECTF--
24NULL
25int(3)
26
27Warning: Undefined property: Crasher::$2 in %s on line %d
28NULL
29string(%s) "DateInterval::__construct(): Unknown or bad format (blah)"
30