aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-rpc/php/worker.php
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-php-rpc/php/worker.php')
-rw-r--r--crates/shirabe-php-rpc/php/worker.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/shirabe-php-rpc/php/worker.php b/crates/shirabe-php-rpc/php/worker.php
index 241dad57..12297c83 100644
--- a/crates/shirabe-php-rpc/php/worker.php
+++ b/crates/shirabe-php-rpc/php/worker.php
@@ -51,6 +51,16 @@ final class ShirabeRustObjectRegistry
return $stub;
}
+ /**
+ * Interns a stub the registry did not build: a `__clone` forwarder rebinds the copy PHP
+ * made to a freshly cloned entity, and that pairing has to be visible to later crossings
+ * of the same handle.
+ */
+ public static function adopt(int $rhandle, object $stub): void
+ {
+ self::$internTable[$rhandle] = WeakReference::create($stub);
+ }
+
/** Invoked when an EpochBump frame arrives. No-op if the stub already died. */
public static function bumpEpoch(int $rhandle, int $epoch): void
{