com php-src: add test: Zend/tests/type_declarations/typed_p roperties_030.phpt

From: Date: Fri, 18 Mar 2016 12:50:40 +0000
Subject: com php-src: add test: Zend/tests/type_declarations/typed_p roperties_030.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95677@lists.php.net to get a copy of this message
Commit: 90fde77b7a5cb1b1c889714333f36003957358c2 Author: Joe Watkins <krakjoe@php.net> Fri, 18 Mar 2016 12:50:40 +0000 Parents: 72e330a508f66aac053918f604c3d202e06f79e4 Branches: typed_ref_properties Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=90fde77b7a5cb1b1c889714333f36003957358c2 Log: add test Changed paths: A Zend/tests/type_declarations/typed_properties_030.phpt Diff: diff --git a/Zend/tests/type_declarations/typed_properties_030.phpt b/Zend/tests/type_declarations/typed_properties_030.phpt new file mode 100644 index 0000000..2749948 --- /dev/null +++ b/Zend/tests/type_declarations/typed_properties_030.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test typed properties unset __get magical magic +--FILE-- +<?php +class Foo { + public int $bar; + + public function __get($name) { + return "violate"; + } +} + +$foo = new Foo; + +$foo->bar = "1"; # ok + +unset($foo->bar); # ok + +var_dump($foo->bar); # not okay, __get is nasty +?> +--EXPECTF-- +Fatal error: Uncaught TypeError: Typed property Foo::$bar must be integer, string used in %s:16 +Stack trace: +#0 {main} + thrown in %s on line 16

« previous php.cvs (#95677) next »