1--TEST-- 2Bug GH-8750 (Can not create VT_ERROR variant type) - cast and conversion 3--EXTENSIONS-- 4com_dotnet 5--FILE-- 6<?php 7$error = new variant(DISP_E_PARAMNOTFOUND, VT_ERROR); 8 9// explicit variant_cast() to int is supported if in range 10echo variant_cast($error, VT_I4), PHP_EOL; 11 12// however, explicit (int) casts are not supported 13echo (int) $error, PHP_EOL; 14 15// nor are implicit conversions 16try { 17 echo 1 + $error, PHP_EOL; 18} catch (TypeError $err) { 19 echo $err->getMessage(), PHP_EOL; 20} 21 22// we can retrieve the type 23echo variant_get_type($error), PHP_EOL; 24 25// and change it via variant_set_type() 26variant_set_type($error, VT_I4); 27echo variant_get_type($error), PHP_EOL; 28?> 29--EXPECTF-- 30-2147352572 31 32Warning: Object of class variant could not be converted to int in %s on line %d 331 34Unsupported operand types: int + variant 3510 363 37