From: Nikita Popov Date: Wed, 23 Oct 2019 10:21:32 +0000 (+0200) Subject: Merge branch 'PHP-7.4' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13e0c5f4c944b83e69cf8d0e24066c2e9b31ff65;p=php Merge branch 'PHP-7.4' * PHP-7.4: Don't autoload when checking property types --- 13e0c5f4c944b83e69cf8d0e24066c2e9b31ff65 diff --cc Zend/tests/type_declarations/typed_properties_class_loading.phpt index 0000000000,0612624454..a81bc5b4fe mode 000000,100644..100644 --- a/Zend/tests/type_declarations/typed_properties_class_loading.phpt +++ b/Zend/tests/type_declarations/typed_properties_class_loading.phpt @@@ -1,0 -1,51 +1,51 @@@ + --TEST-- + Typed properties do not invoke the autoloader + --FILE-- + propX = new stdClass; + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + if (true) { + class X {} + } + + $test->propX = new X; + var_dump($test->propX); + + $test->propY = null; + $r =& $test->propY; + try { + $test->propY = new stdClass; + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + if (true) { + class Y {} + } + + $r = new Y; + var_dump($test->propY); + + ?> + --EXPECT-- -Typed property Test::$propX must be an instance of X, stdClass used ++Cannot assign stdClass to property Test::$propX of type X + object(X)#3 (0) { + } -Typed property Test::$propY must be an instance of Y or null, stdClass used ++Cannot assign stdClass to property Test::$propY of type ?Y + object(Y)#4 (0) { + }