diff --git a/src/CompilerBase.php b/src/CompilerBase.php index e5355646..4b556df5 100644 --- a/src/CompilerBase.php +++ b/src/CompilerBase.php @@ -1865,7 +1865,11 @@ class CompilerBase implements PropertyAccessContext } else { return null; } - $function = $this->getNativeMethod($expr, $class, $method, false); + try { + $function = $this->getNativeMethod($expr, $class, $method, false); + } catch (DynamicCall) { + return null; + } if ($function !== false) { return $this->getFunction($function)->returnsByRef; } @@ -1892,7 +1896,11 @@ class CompilerBase implements PropertyAccessContext $class = $this->getNamespacedClassName($class); } $method = $this->parseIdentifier($expr->name); - $function = $this->getNativeMethod($expr, $class, $method, false); + try { + $function = $this->getNativeMethod($expr, $class, $method, false); + } catch (DynamicCall) { + return null; + } if ($function !== false) { return $this->getFunction($function)->returnsByRef; } diff --git a/src/Parser/MethodCallTrait.php b/src/Parser/MethodCallTrait.php index 6ede7f2c..4a8eeef6 100644 --- a/src/Parser/MethodCallTrait.php +++ b/src/Parser/MethodCallTrait.php @@ -397,6 +397,7 @@ trait MethodCallTrait 'Method Call: ', $object . '->' . $this->parseIdentifier($expr->name) . '()' ); + $nativeFunc = false; try { $nativeFunc = $this->findNativeMethod($expr, $object, $this->parseIdentifier($expr->name)); if ($nativeFunc) {