diff --git a/src/Translator.php b/src/Translator.php index 097d407d..e060d909 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -3535,6 +3535,20 @@ private function genExtensionIncludeHeaderFiles(): string $declarationHeaders[] = $header; } } + // Nano policy mode (Windows, the WINDOWS_DLL backend) emits a direct + // php_main() call inside RINIT instead of relying on ZendVM eval, so + // the entry function's declaration header — which carries the + // php_main() prototype — must be visible to this translation unit. + // True Nano mode keeps php_main() encapsulated inside the separate + // nano-entry translation unit, so only the policy path needs this. + if ($this->isNanoPolicyMode() && $this->hasFunction(self::ENTRY_FUNCTION)) { + $entryHeader = $this->declarationHeaderFiles[ + $this->getFunction(self::ENTRY_FUNCTION)->sourceFile + ] ?? null; + if ($entryHeader !== null && !in_array($entryHeader, $declarationHeaders, true)) { + $declarationHeaders[] = $entryHeader; + } + } } return $this->renderIncludeHeaderFiles([