Closures cannot be serialised inside of arrays. This is because arrays are simply serialised with PHP's internal serialiser. Closures require special handling with serialisation, and so arrays will need to be serialised differently if this is going to work. The ph_hashtable_t type should be reusable for this, so it should be a matter of mapping PHP's hash table to phactor's hash table.
Example:
<?php
use phactor\{ActorSystem, Actor, ActorRef};
$as = new ActorSystem(1);
class A extends Actor
{
public function __construct(array $a){}
public function receive(){}
}
$a = new ActorRef(A::class, [[function(){}]], 'a');
ActorSystem::shutdown();
Closures cannot be serialised inside of arrays. This is because arrays are simply serialised with PHP's internal serialiser. Closures require special handling with serialisation, and so arrays will need to be serialised differently if this is going to work. The
ph_hashtable_t
type should be reusable for this, so it should be a matter of mapping PHP's hash table to phactor's hash table.Example: