PHC Runtime & Compatibility
Running Xao on PHC in isolate and worker modes, sandbox defaults, worker-safe autoloading, and P00–P05 compatibility findings.
Xao is verified continuously against PHC (phc check, phc run, and phc serve in both isolate and worker modes) alongside PHP 8.4 parity checks.
Summary of PHC Capabilities & Workarounds
| Area | Status | Notes |
|---|---|---|
| Worker-mode closure autoloader | Workaround in place | src/autoload.php registers a named global function xao_autoload() guarded by function_exists() rather than an anonymous closure |
DOMDocument & namespace-aware DOM | Resolved in PHC P11 (xot) | Supports createElementNS, getElementsByTagNameNS, importNode, C14N |
DOMXPath queries & predicates | Resolved in PHC P11 (xee-xpath) | Supports query(), evaluate(), registerNamespace(), axes, predicates |
xml:space="preserve" text nodes | Resolved in PHC (xml.rs) | Preserves leading/trailing spaces inside <text xml:space="preserve"> |
Native XSLT 3.0 (xsl3) | Default build (P10) | XSLTProcessor in-process via pure-Rust xee-xslt/xot |
CommonMark XML 1.0 (markdown-xml) | Default build (P12) | phc_markdown_to_xml() / phc_markdown_to_dom() via comrak |
LIBXML_NONET constant | Guarded in DomDoc | Checked with defined('LIBXML_NONET') at runtime |
Sandbox Defaults (phc.toml)
PHC executes request handlers inside a deny-by-default sandbox:
allow_network = falseby default: BecausePhcNativeXsltDriverruns in-process, Xao and XaoDocs need zero network egress. Setallow_network = trueonly when usingSaxonHttpDriveror fetching remote HTTP APIs.allowed_roots: Explicitly list every directory accessed by the app (for example["public", "src", "stylesheets", "data"], or["public", "src", "content", "themes", "../../Xao/src"]in XaoDocs).allow_file_databases: Enable only when using file-backed SQLite databases viaPDO.Relative paths in PHP: Always anchor filesystem paths to
dirname(__DIR__)rather thangetcwd(), which can differ between CLI (phc run),isolate, andworkermodes.
xee-xslt Authoring Notes
When authoring stylesheets for PhcNativeXsltDriver (xee-xslt):
Prefer
<xsl:apply-templates select="..." mode="..."/>over<xsl:call-template>(unsupported in currentxee-xslt).Prefer XPath 3.1 sibling grouping (
following-sibling::*[preceding-sibling::cm:heading[@level='2'][1] is $h]) over<xsl:for-each-group>.Declare
<xsl:variable>bindings before any literal result elements in the same enclosing block, and format numbers with XPath expressions rather than<xsl:number>orformat-number().Use
expand-text="yes",xsl:include,xsl:import,xsl:output method="html",xsl:param,xsl:element,xsl:attribute, andpriority="2"overrides freely.