Closed jakubmisek closed 2 years ago
when passing values to arguments typed as object, the behavior is unexpected.
object
<?php function f(object $o) { } $a = 123; f($a); $f = "f"; $f($a);
Actual:
PhpValue.AsObject()
123
null
f()
$o
argnull
Expected:
TypeError
StrictConvert.ToObject
when passing values to arguments typed as
object
, the behavior is unexpected.Actual:
PhpValue.AsObject()
.123
is "converted" tonull
f()
checks$o
if it's notnull
and throwsargnull
exceptionf()
may not check argument fornull
, if the argument$o
is nullablef()
is a CLR/C# method, it getsnull
silently without any warning or runtime checkExpected:
TypeError
exception should be thrown.StrictConvert.ToObject
should be used to either getobject
ornull
orTypeError
exception