Doc #79206 [NEW]: Access to an uninizialized property generates Error instead of TypeError
From: greedy dot ivan at gmail dot com
Operating system:
PHP version: 7.4.2
Package: PHP Language Specification
Bug Type: Documentation Problem
Bug description:Access to an uninizialized property generates Error instead of TypeError
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 bug report at https://bugs.php.net/bug.php?id=79206&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79206&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79206&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79206&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79206&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79206&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79206&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79206&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79206&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79206&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79206&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79206&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79206&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79206&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79206&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79206&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79206&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79206&r=mysqlcfg
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.