Closed remcotolsma closed 6 months ago
Related: https://github.com/WordPress/wordpress-playground/issues/273
@bgrgicak it would be nice to also test for generators and reaching for network resources between yield
s
I can take a look at this one next week.
I wasn't able to recreate the error using the above code, but this causes a similar issue:
php.writeFile(
joinPaths(docroot, 'test.php'),
`<?php
$data = new class() implements IteratorAggregate {
public function getIterator(): Traversable {
post_message_to_js( 'test' );
return new ArrayIterator( [] );
}
};
echo json_encode( [
...$data
] );
`
);
@remcotolsma did that solve the problem for you? The latest version is now deployed to https://playground.wordpress.net/
As a colleague of @remcotolsma, I followed along and it seems that the additions to ASYNCIFY_ONLY
indeed resolve the issue with iterators. Thanks!
The following code causes an
Error: "unreachable" WASM instruction executed.
: