Doc #79206 [Opn->Fbk]: Access to an uninizialized property generates Error instead of TypeError
Edit report at https://bugs.php.net/bug.php?id=79206&edit=1
ID: 79206
Updated by: requinix@php.net
Reported by: greedy dot ivan at gmail dot com
Summary: Access to an uninizialized property generates Error
instead of TypeError
-Status: Open
+Status: Feedback
Type: Documentation Problem
Package: *General Issues
PHP Version: 7.4.2
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2020-02-01 22:01:04] requinix@php.net
Yes, that's right. What about it?
------------------------------------------------------------------------
[2020-02-01 12:55:52] greedy dot ivan at gmail dot com
Description:
------------
> Reads from uninitialized properties will generate a TypeError
-- https://wiki.php.net/rfc/typed_properties_v2#uninitialized_and_unset_properties
Actually, it generates Error.
Test script:
---------------
<?php
class Foo {
public int $bar;
}
$foo = new Foo();
try {
$foo->bar;
} catch (\TypeError $te) {
var_dump('TypeError catched');
} catch (\Error $e) {
var_dump('Error catched');
} catch (\Throwable $t) {
var_dump('Throwable catched');
}
Expected result:
----------------
TypeError catched
Actual result:
--------------
Error catched
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79206&edit=1
Thread (11 messages)
- greedy dot ivan at gmail dot com
- requinix@php.netDoc #79206 [Opn]: Access to an uninizialized property generates Error instead of TypeError
- requinix@php.netDoc #79206 [Opn->Fbk]: Access to an uninizialized property generates Error instead of TypeError
- greedy dot ivan at gmail dot comDoc #79206 [Com]: Access to an uninizialized property generates Error instead of TypeError
- requinix@php.netDoc #79206 [Fbk]: Access to an uninizialized property generates Error instead of TypeError
- greedy dot ivan at gmail dot comDoc #79206 [Com]: Access to an uninizialized property generates Error instead of TypeError
- requinix@php.netDoc #79206 [Fbk->Ver]: More typed properties docs: uninitialized state, behavior with __get/set, etc.
- deleugyn+php at gmail dot comDoc #79206 [Com]: More typed properties docs: uninitialized state, behavior with __get/set, etc.
- requinix@php.netDoc #79206 [Ver->Fbk]: More typed properties docs: uninitialized state, behavior with __get/set, etc.
- greedy dot ivan at gmail dot comDoc #79206 [Com]: More typed properties docs: uninitialized state, behavior with __get/set, etc.
- cmb@php.netDoc #79206 [Fbk->Csd]: More typed properties docs: uninitialized state, behavior with __get/set, etc.