1--TEST-- 2Using ::class on an object 3--FILE-- 4<?php 5 6$obj = new stdClass; 7var_dump($obj::class); 8$ref =& $obj; 9var_dump($ref::class); 10var_dump((new stdClass)::class); 11 12// Placed in a function to check that opcache doesn't perform incorrect constprop. 13function test() { 14 $other = null; 15 var_dump($other::class); 16} 17try { 18 test(); 19} catch (TypeError $e) { 20 echo $e->getMessage(), "\n"; 21} 22 23?> 24--EXPECT-- 25string(8) "stdClass" 26string(8) "stdClass" 27string(8) "stdClass" 28Cannot use "::class" on null 29