TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
574 B

--TEST--
Native class: include and eval operands use the declared toString method
--FILE--
<?php
#[Native]
class NativeStringOperand
{
public string $value;
public function __construct(string $value)
{
$this->value = $value;
}
public function toString(): string
{
return $this->value;
}
}
function main(): void
{
$path = new NativeStringOperand(__DIR__ . '/include-native-path.inc');
include $path;
$source = new NativeStringOperand('echo "evaluated\\n";');
eval($source);
}
?>
--EXPECT--
included
evaluated