On 5/25/16 5:52 PM, Thomas Bley wrote:
I'm not seeing a problem here:

class A {
  public int $x;
  public ?int $y = null;
  public int $z = 42;
  public ?int $u;
  public ?datetime $v;
  public datetime $w;
}

$a = new A;
var_dump($a->x); // 0 + notice
var_dump($a->y); // null
var_dump($a->z); // 42
var_dump(isset($a->z)); // true
unset($a->z);
var_dump(isset($a->z)); // false
var_dump($a->z); // 0 + notice
var_dump($a->u); // null + notice
var_dump($a->v); // null + notice
var_dump($a->w); // Fatal error, uninitialized...

var_dump(isset($a->x)); // false
var_dump(isset($a->y)); // false
var_dump(isset($a->u)); // false
var_dump(isset($a->v)); // false
var_dump(isset($a->w)); // false

Is the file containing these examples in liberal mode?

What changes if declare(strict_types=1) precedes $a = new A;?

Tom


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to