diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index faad75b1..f898c572 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -3528,7 +3528,11 @@ class CompilerBase extends \PhpAot\Core\Translator $nativeFunc = $this->findNativeMethod($expr, $object, $this->parseIdentifier($expr->name)); if ($nativeFunc) { $expr->setAttribute('nativeCall', $nativeFunc); - return $this->parseNativeMethodCall($object, $nativeFunc, $expr->args); + try { + return $this->parseNativeMethodCall($object, $nativeFunc, $expr->args); + } catch (PlaceHolder) { + return $this->genPlaceHolder($this->genArray([$object, $method])); + } } } diff --git a/tests/aot/native-type.phpt b/tests/aot/native-type.phpt index afa92536..467a361e 100644 --- a/tests/aot/native-type.phpt +++ b/tests/aot/native-type.phpt @@ -15,4 +15,6 @@ function main() } ?> --EXPECT-- -float(2.5) +int(100) +float(100) +bool(true) diff --git a/tests/aot/place-holder-002.phpt b/tests/aot/place-holder-002.phpt new file mode 100644 index 00000000..67ed626d --- /dev/null +++ b/tests/aot/place-holder-002.phpt @@ -0,0 +1,41 @@ +--TEST-- +place-holder +--FILE-- +mainSocket = 'tcp-stream'; + } + + public function resumeAccept() + { + static::$globalEvent->onReadable($this->mainSocket, $this->acceptUdpConnection(...)); + } + + protected function acceptUdpConnection($stream) + { + var_dump(__METHOD__); + var_dump($stream); + } +} + +function main() +{ + $obj = new Worker; + Worker::$globalEvent = new Select; + $obj->resumeAccept(); +} +?> +--EXPECT-- +string(27) "Worker::acceptUdpConnection" +string(10) "tcp-stream" +