1--TEST-- 2Defining constants with non-scalar values 3--FILE-- 4<?php 5 6try { 7 define('foo', new stdClass); 8} catch (TypeError $exception) { 9 echo $exception->getMessage() . "\n"; 10} 11 12try { 13 var_dump(foo); 14} catch (Error $e) { 15 echo $e->getMessage(), "\n"; 16} 17 18define('foo', fopen(__FILE__, 'r')); 19var_dump(foo); 20 21?> 22--EXPECT-- 23define(): Argument #2 ($value) cannot be an object, stdClass given 24Undefined constant "foo" 25resource(5) of type (stream) 26