diff --git a/phpunit/code/function-method-symbol-collision.php b/phpunit/code/function-method-symbol-collision.php new file mode 100644 index 00000000..03ff57f4 --- /dev/null +++ b/phpunit/code/function-method-symbol-collision.php @@ -0,0 +1,17 @@ +addFiles([$testFile]); + $compiler->prepareFile($testFile); + $cppFile = $compiler->convertFile($testFile); + $cpp = file_get_contents($cppFile); + + $this->assertStringContainsString('php::call(', $cpp); + $this->assertStringNotContainsString('php_collision__worker__validate(validater)', $cpp); + } + public function testReturnRef(): void { $this->compile('function-return-ref.php'); diff --git a/src/CompilerBase.php b/src/CompilerBase.php index 37922f79..2663aadf 100644 --- a/src/CompilerBase.php +++ b/src/CompilerBase.php @@ -2845,7 +2845,7 @@ class CompilerBase implements PropertyAccessContext $nativeFunc = $this->escapeNamespace($nativeFunc); } $this->checkFunction($nativeFunc); - if ($this->hasFunction($nativeFunc)) { + if ($this->hasFunction($nativeFunc) && !$this->getFunction($nativeFunc)->method) { return $nativeFunc; } }