On 17/11/2025 09:49, Edmond Dantes wrote:
Regarding the hybrid function-tainting model, it is designed for
compilers or static analysis. For PHP, it could be implemented like
this:

```php
#NoAsync
function myFun() {
     asyncFun(); // Error <---
}

function asyncFun() {}
```

This is a solvable task for static analysis.


As I understand it, Larry's suggestion was not to prevent marked code from calling into an async function, but to force the called function into sync mode.

Imagine you have code like this running PHP 8.4, using a third-party SDK library:

function myFun() {
    $input = someThingWithSharedState();
    $data = SomeApiSdk\someFunction($input);
    someOtherThingWithSharedState($data);
}

Then in 9.0, we get True Async, and the author of the SDK starts using async I/O functions somewhere deep in the library.

Without any special marking, other functions can run between the statements in this function, completely unknown to the author of myFun()

If you mark it as "NoAsync" in the sense you've described, a static analyser can point out the problem, but you still have no solution, short of forking the SDK and removing all async code.


Larry's "sync" marker would be a change to *run-time behaviour*: when myFun() begins, the scheduler switches into "linear mode", until the end of that function. In that mode, when a suspend() point is reached, the scheduler immediately resumes that coroutine rather than choosing a different one.

If this was marked by an attribute, you could add it to code that supports both PHP 8.x and 9.x, and the code would run the same in both versions.


Aside: I definitely think that if/when True Async is added, we should call the resulting version PHP 9.0 not 8.5 or 8.6 or whatever. As well as potentially requiring users to review code for dangerous cases, it would be a huge new feature worthy of the branding of a major version.


--
Rowan Tommins
[IMSoP]

Reply via email to