Skip to content

Commit d374bef

Browse files
fix: setVars() checks the thread like the rest of the handle
The constructor is not a gate, see the handle's other methods: a caller that got hold of one some other way would otherwise publish vars from a thread that is not a background worker, where the Go side has no slot to put them in.
1 parent 2e985ad commit d374bef

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

frankenphp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,14 +1503,16 @@ void frankenphp_vars_free(HashTable *table) {
15031503
persistent_zval_free(&persistent);
15041504
}
15051505

1506-
/* Holding a handle means being a background worker: the constructor is the
1507-
* gate, so no caller check is needed here. */
15081506
ZEND_METHOD(FrankenPHP_WorkerHandle, setVars) {
15091507
zval *vars;
15101508
ZEND_PARSE_PARAMETERS_START(1, 1)
15111509
Z_PARAM_ARRAY(vars)
15121510
ZEND_PARSE_PARAMETERS_END();
15131511

1512+
if (!frankenphp_worker_handle_usable()) {
1513+
RETURN_THROWS();
1514+
}
1515+
15141516
/* validate the whole tree first: persist and free recurse without a
15151517
* guard of their own */
15161518
if (!persistent_zval_validate(vars)) {

0 commit comments

Comments
 (0)