diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 3c013f32..a927bcb9 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -3586,7 +3586,7 @@ class CompilerBase extends \PhpAot\Core\Translator if ($namespace) { $findClass = $namespace . '\\' . $class; } - $scope = $this->class ? $namespace . '\\' . $class : ''; + $scope = $this->class ? ltrim($namespace . '\\' . $class, '\\') : ''; while (true) { if ($this->hasNativeClass($findClass)) { diff --git a/tests/aot/private-prop-001.phpt b/tests/aot/private-prop-001.phpt new file mode 100644 index 00000000..a7682cc4 --- /dev/null +++ b/tests/aot/private-prop-001.phpt @@ -0,0 +1,29 @@ +--TEST-- +Static Class Property Read/Write Test +--FILE-- +errorHandler = $errorHandler; + var_dump($this->errorHandler); + } +} + +class Worker +{ + public static ?stdClass $globalEvent = null; + + public static function init() { + self::$globalEvent = new Select; + self::$globalEvent->setErrorHandler('test'); + } +} + +function main() { + Worker::init(); +} +?> +--EXPECT-- +string(4) "test" \ No newline at end of file