Expand description
Raw FFI bindings to PHP embed SAPI and our C helper functions.
We use manual declarations rather than bindgen for the POC — only the functions we actually call are declared here.
Structs§
- folk_
request_ context - Per-request context passed from Rust to our SAPI callbacks.
Must match
folk_request_context_tinphp_embed_helper.c. - zval
- Opaque PHP zval (Zend value). 16 bytes on 64-bit. We never access fields directly — only through our C helper functions.
Constants§
Functions§
- folk_
array_ ⚠add_ array - Add a sub-array to a PHP array by key.
- folk_
array_ ⚠add_ long - Add a long to a PHP array by key.
- folk_
array_ ⚠add_ string - Add a string to a PHP array by key.
- folk_
array_ ⚠append_ string - Append a string to a PHP array (numeric index).
- folk_
array_ ⚠count - Get array element count.
- folk_
array_ ⚠get_ long - Read long from PHP array by key.
- folk_
array_ ⚠get_ string - Read string from PHP array by key.
- folk_
array_ ⚠index_ string - Get string from array by numeric index.
- folk_
array_ ⚠init - Create a new PHP array zval.
- folk_
call_ ⚠function_ protected - Call function with SIGSEGV protection. Returns -3 on SIGSEGV.
- folk_
call_ ⚠function_ safe - folk_
call_ ⚠with_ array - Call PHP function with single array argument. Returns -3 on SIGSEGV.
- folk_
call_ ⚠with_ binary - Call PHP function with raw binary args (no base64). Returns -3 on SIGSEGV.
- folk_
clear_ ⚠output - folk_
eval_ ⚠string_ protected - Eval with SIGSEGV protection. Returns -3 on SIGSEGV.
- folk_
eval_ ⚠string_ safe - folk_
execute_ ⚠script_ safe - folk_
free_ ⚠buffer - Free a buffer allocated by
folk_call_with_binary. - folk_
free_ ⚠output - folk_
get_ ⚠output - folk_
install_ ⚠output_ handler - Install our output capture handler into the embed SAPI module.
Only needed for legacy embed SAPI (
boot()), not for custom SAPI. - folk_
is_ ⚠zts - Returns 1 if ZTS build, 0 if NTS.
- folk_
request_ ⚠context_ clear - Clear the current request context (after
request_shutdown). - folk_
request_ ⚠context_ set - Set the current request context (before
request_startup). - folk_
request_ ⚠shutdown_ safe - folk_
request_ ⚠startup_ safe - folk_
response_ ⚠clear - Clear response state (between requests).
- folk_
response_ ⚠free - Free all response resources (thread shutdown).
- folk_
response_ ⚠header_ count - Get the number of captured response headers.
- folk_
response_ ⚠header_ get - Get a response header by index. Sets
*out_len. - folk_
response_ ⚠status_ code - Get the response HTTP status code.
- folk_
sapi_ ⚠init - Initialize PHP with our custom Folk SAPI (replaces
php_embed_init). - folk_
sapi_ ⚠init_ with_ ini - Initialize PHP with custom INI overrides (double-NUL terminated).
- folk_
sapi_ ⚠shutdown - Shutdown our custom SAPI (replaces
php_embed_shutdown). - folk_
signals_ ⚠restore - Restore saved signal handlers (call after
folk_sapi_init). - folk_
signals_ ⚠save - Save current signal handlers (call before
folk_sapi_init). - folk_
sigsegv_ ⚠handler_ install - Install SIGSEGV handler for worker thread protection.
- folk_
thread_ ⚠init - Allocate TSRM context for current thread (ZTS). Returns NULL on NTS.
- folk_
thread_ ⚠set_ ctx - Set TSRM context for current thread.
- folk_
thread_ ⚠shutdown - Free TSRM context.
- folk_
zval_ ⚠dtor - folk_
zval_ ⚠get_ long - folk_
zval_ ⚠get_ string - folk_
zval_ ⚠set_ string - folk_
zval_ ⚠type - folk_
zval_ ⚠undef - php_
embed_ ⚠init - php_
embed_ ⚠shutdown