refactor(bootstrap): 调整函数文件加载方式并更新依赖

- 将 src/functions.php 从 composer autoloader 移至 bootstrap 文件直接引入
- 更新 composer.json 配置移除 functions.php 的文件自动加载配置
- 升级多个依赖包版本包括 league/climate、symfony 相关组件等
- 新增 ergebnis/agent-detector 依赖用于代理检测功能
- 更新 phpunit 和相关开发依赖到最新稳定版本
pull/1/head
韩天峰 4 months ago
parent 9744cc9e86
commit 69a1c24610
  1. 1
      bin/bootstrap.php
  2. 5
      composer.json
  3. 330
      composer.lock
  4. 11
      examples/error/error.php
  5. 17
      src/Php/Preprocessor.php
  6. 21
      src/Php/Translator.php
  7. 45
      src/cpp/main.cc
  8. 2
      src/template/extension.cc.php

@ -3,3 +3,4 @@ define("ROOT_PATH", dirname(__DIR__));
define('DEBUG', true); define('DEBUG', true);
require ROOT_PATH . '/vendor/autoload.php'; require ROOT_PATH . '/vendor/autoload.php';
require ROOT_PATH . '/src/functions.php';

@ -13,10 +13,7 @@
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"PhpAot\\": "src" "PhpAot\\": "src"
}, }
"files": [
"src/functions.php"
]
}, },
"scripts": { "scripts": {
"cs-fix": "php-cs-fixer fix $1", "cs-fix": "php-cs-fixer fix $1",

330
composer.lock generated

@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "league/climate", "name": "league/climate",
"version": "3.10.0", "version": "3.10.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/climate.git", "url": "https://github.com/thephpleague/climate.git",
"reference": "237f70e1032b16d32ff3f65dcda68706911e1c74" "reference": "f2d78fbc504740bcd0209e40a4586c886567ddc9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/climate/zipball/237f70e1032b16d32ff3f65dcda68706911e1c74", "url": "https://api.github.com/repos/thephpleague/climate/zipball/f2d78fbc504740bcd0209e40a4586c886567ddc9",
"reference": "237f70e1032b16d32ff3f65dcda68706911e1c74", "reference": "f2d78fbc504740bcd0209e40a4586c886567ddc9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -28,7 +28,7 @@
"require-dev": { "require-dev": {
"mikey179/vfsstream": "^1.6.12", "mikey179/vfsstream": "^1.6.12",
"mockery/mockery": "^1.6.12", "mockery/mockery": "^1.6.12",
"phpunit/phpunit": "^9.5.10", "phpunit/phpunit": "^9.6.21",
"squizlabs/php_codesniffer": "^3.10" "squizlabs/php_codesniffer": "^3.10"
}, },
"suggest": { "suggest": {
@ -68,9 +68,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/thephpleague/climate/issues", "issues": "https://github.com/thephpleague/climate/issues",
"source": "https://github.com/thephpleague/climate/tree/3.10.0" "source": "https://github.com/thephpleague/climate/tree/3.10.1"
}, },
"time": "2024-11-18T09:09:55+00:00" "time": "2026-03-19T19:32:55+00:00"
}, },
{ {
"name": "marcj/topsort", "name": "marcj/topsort",
@ -299,16 +299,16 @@
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.33.0", "version": "v1.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" "reference": "141046a8f9477948ff284fa65be2095baafb94f2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "reference": "141046a8f9477948ff284fa65be2095baafb94f2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -358,7 +358,7 @@
"portable" "portable"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" "source": "https://github.com/symfony/polyfill-ctype/tree/v1.36.0"
}, },
"funding": [ "funding": [
{ {
@ -378,20 +378,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-09-09T11:45:10+00:00" "time": "2026-04-10T16:19:22+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.33.0", "version": "v1.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315",
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -443,7 +443,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.36.0"
}, },
"funding": [ "funding": [
{ {
@ -463,20 +463,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-12-23T08:48:59+00:00" "time": "2026-04-10T17:25:58+00:00"
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v8.0.4", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "326e0406fc315eca57ef5740fa4a280b7a068c82" "reference": "cfb7badd53bf4177f6e9416cfbbccc13c0e773a1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/326e0406fc315eca57ef5740fa4a280b7a068c82", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cfb7badd53bf4177f6e9416cfbbccc13c0e773a1",
"reference": "326e0406fc315eca57ef5740fa4a280b7a068c82", "reference": "cfb7badd53bf4177f6e9416cfbbccc13c0e773a1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -530,7 +530,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v8.0.4" "source": "https://github.com/symfony/var-dumper/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -550,20 +550,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-01-01T23:07:29+00:00" "time": "2026-03-31T07:15:36+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v8.0.1", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "7a1a90ba1df6e821a6b53c4cabdc32a56cabfb14" "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/7a1a90ba1df6e821a6b53c4cabdc32a56cabfb14", "url": "https://api.github.com/repos/symfony/yaml/zipball/54174ab48c0c0f9e21512b304be17f8150ccf8f1",
"reference": "7a1a90ba1df6e821a6b53c4cabdc32a56cabfb14", "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -605,7 +605,7 @@
"description": "Loads and dumps YAML files", "description": "Loads and dumps YAML files",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/yaml/tree/v8.0.1" "source": "https://github.com/symfony/yaml/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -625,7 +625,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-12-04T18:17:06+00:00" "time": "2026-03-30T15:14:47+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -915,6 +915,75 @@
], ],
"time": "2024-05-06T16:37:16+00:00" "time": "2024-05-06T16:37:16+00:00"
}, },
{
"name": "ergebnis/agent-detector",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/ergebnis/agent-detector.git",
"reference": "5b654a9f1ff8a5d2ce6a57568df5ae8801c87f64"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ergebnis/agent-detector/zipball/5b654a9f1ff8a5d2ce6a57568df5ae8801c87f64",
"reference": "5b654a9f1ff8a5d2ce6a57568df5ae8801c87f64",
"shasum": ""
},
"require": {
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.50.0",
"ergebnis/license": "^2.7.0",
"ergebnis/php-cs-fixer-config": "^6.60.2",
"ergebnis/phpstan-rules": "^2.13.1",
"ergebnis/phpunit-slow-test-detector": "^2.24.0",
"ergebnis/rector-rules": "^1.16.0",
"fakerphp/faker": "^1.24.1",
"infection/infection": "^0.26.6",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.1.46",
"phpstan/phpstan-deprecation-rules": "^2.0.4",
"phpstan/phpstan-phpunit": "^2.0.16",
"phpstan/phpstan-strict-rules": "^2.0.10",
"phpunit/phpunit": "^9.6.34",
"rector/rector": "^2.4.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.0-dev"
},
"composer-normalize": {
"indent-size": 2,
"indent-style": "space"
}
},
"autoload": {
"psr-4": {
"Ergebnis\\AgentDetector\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andreas Möller",
"email": "am@localheinz.com",
"homepage": "https://localheinz.com"
}
],
"description": "Provides a detector for detecting the presence of an agent.",
"homepage": "https://github.com/ergebnis/agent-detector",
"support": {
"issues": "https://github.com/ergebnis/agent-detector/issues",
"security": "https://github.com/ergebnis/agent-detector/blob/main/.github/SECURITY.md",
"source": "https://github.com/ergebnis/agent-detector"
},
"time": "2026-04-10T13:45:13+00:00"
},
{ {
"name": "evenement/evenement", "name": "evenement/evenement",
"version": "v3.0.2", "version": "v3.0.2",
@ -1025,22 +1094,23 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.92.5", "version": "v3.95.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58" "reference": "a9727678fbd12997f1d9de8f4a37824ed9df1065"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/a9727678fbd12997f1d9de8f4a37824ed9df1065",
"reference": "260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58", "reference": "a9727678fbd12997f1d9de8f4a37824ed9df1065",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"clue/ndjson-react": "^1.3", "clue/ndjson-react": "^1.3",
"composer/semver": "^3.4", "composer/semver": "^3.4",
"composer/xdebug-handler": "^3.0.5", "composer/xdebug-handler": "^3.0.5",
"ergebnis/agent-detector": "^1.1.1",
"ext-filter": "*", "ext-filter": "*",
"ext-hash": "*", "ext-hash": "*",
"ext-json": "*", "ext-json": "*",
@ -1051,7 +1121,7 @@
"react/event-loop": "^1.5", "react/event-loop": "^1.5",
"react/socket": "^1.16", "react/socket": "^1.16",
"react/stream": "^1.4", "react/stream": "^1.4",
"sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0 || ^8.0",
"symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0", "symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", "symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
@ -1065,18 +1135,18 @@
"symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0" "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0"
}, },
"require-dev": { "require-dev": {
"facile-it/paraunit": "^1.3.1 || ^2.7", "facile-it/paraunit": "^1.3.1 || ^2.8.0",
"infection/infection": "^0.31", "infection/infection": "^0.32.6",
"justinrainbow/json-schema": "^6.6", "justinrainbow/json-schema": "^6.8.0",
"keradus/cli-executor": "^2.3", "keradus/cli-executor": "^2.3",
"mikey179/vfsstream": "^1.6.12", "mikey179/vfsstream": "^1.6.12",
"php-coveralls/php-coveralls": "^2.9", "php-coveralls/php-coveralls": "^2.9.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.8",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.8",
"phpunit/phpunit": "^9.6.31 || ^10.5.60 || ^11.5.46", "phpunit/phpunit": "^9.6.34 || ^10.5.63 || ^11.5.55",
"symfony/polyfill-php85": "^1.33", "symfony/polyfill-php85": "^1.33",
"symfony/var-dumper": "^5.4.48 || ^6.4.26 || ^7.4.0 || ^8.0", "symfony/var-dumper": "^5.4.48 || ^6.4.32 || ^7.4.4 || ^8.0.8",
"symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.4.1 || ^8.0" "symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.4.1 || ^8.0.8"
}, },
"suggest": { "suggest": {
"ext-dom": "For handling output formats in XML", "ext-dom": "For handling output formats in XML",
@ -1117,7 +1187,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.5" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.95.1"
}, },
"funding": [ "funding": [
{ {
@ -1125,7 +1195,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2026-01-08T21:57:37+00:00" "time": "2026-04-12T17:00:09+00:00"
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
@ -1628,16 +1698,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "10.5.60", "version": "10.5.63",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "f2e26f52f80ef77832e359205f216eeac00e320c" "reference": "33198268dad71e926626b618f3ec3966661e4d90"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f2e26f52f80ef77832e359205f216eeac00e320c", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33198268dad71e926626b618f3ec3966661e4d90",
"reference": "f2e26f52f80ef77832e359205f216eeac00e320c", "reference": "33198268dad71e926626b618f3ec3966661e4d90",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1658,7 +1728,7 @@
"phpunit/php-timer": "^6.0.0", "phpunit/php-timer": "^6.0.0",
"sebastian/cli-parser": "^2.0.1", "sebastian/cli-parser": "^2.0.1",
"sebastian/code-unit": "^2.0.0", "sebastian/code-unit": "^2.0.0",
"sebastian/comparator": "^5.0.4", "sebastian/comparator": "^5.0.5",
"sebastian/diff": "^5.1.1", "sebastian/diff": "^5.1.1",
"sebastian/environment": "^6.1.0", "sebastian/environment": "^6.1.0",
"sebastian/exporter": "^5.1.4", "sebastian/exporter": "^5.1.4",
@ -1709,7 +1779,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.60" "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.63"
}, },
"funding": [ "funding": [
{ {
@ -1733,7 +1803,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-12-06T07:50:42+00:00" "time": "2026-01-27T05:48:37+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@ -2534,16 +2604,16 @@
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
"version": "5.0.4", "version": "5.0.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git", "url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "e8e53097718d2b53cfb2aa859b06a41abf58c62e" "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e8e53097718d2b53cfb2aa859b06a41abf58c62e", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55dfef806eb7dfeb6e7a6935601fef866f8ca48d",
"reference": "e8e53097718d2b53cfb2aa859b06a41abf58c62e", "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2599,7 +2669,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues", "issues": "https://github.com/sebastianbergmann/comparator/issues",
"security": "https://github.com/sebastianbergmann/comparator/security/policy", "security": "https://github.com/sebastianbergmann/comparator/security/policy",
"source": "https://github.com/sebastianbergmann/comparator/tree/5.0.4" "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.5"
}, },
"funding": [ "funding": [
{ {
@ -2619,7 +2689,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-09-07T05:25:07+00:00" "time": "2026-01-24T09:25:16+00:00"
}, },
{ {
"name": "sebastian/complexity", "name": "sebastian/complexity",
@ -3319,16 +3389,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v8.0.3", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587" "reference": "5b66d385dc58f69652e56f78a4184615e3f2b7f7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", "url": "https://api.github.com/repos/symfony/console/zipball/5b66d385dc58f69652e56f78a4184615e3f2b7f7",
"reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", "reference": "5b66d385dc58f69652e56f78a4184615e3f2b7f7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3385,7 +3455,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v8.0.3" "source": "https://github.com/symfony/console/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -3405,7 +3475,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-12-23T14:52:06+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -3476,16 +3546,16 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v8.0.0", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "573f95783a2ec6e38752979db139f09fec033f03" "reference": "f662acc6ab22a3d6d716dcb44c381c6002940df6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/573f95783a2ec6e38752979db139f09fec033f03", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f662acc6ab22a3d6d716dcb44c381c6002940df6",
"reference": "573f95783a2ec6e38752979db139f09fec033f03", "reference": "f662acc6ab22a3d6d716dcb44c381c6002940df6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3537,7 +3607,7 @@
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/event-dispatcher/tree/v8.0.0" "source": "https://github.com/symfony/event-dispatcher/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -3557,7 +3627,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-10-30T14:17:19+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "symfony/event-dispatcher-contracts", "name": "symfony/event-dispatcher-contracts",
@ -3637,16 +3707,16 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v8.0.1", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "d937d400b980523dc9ee946bb69972b5e619058d" "reference": "66b769ae743ce2d13e435528fbef4af03d623e5a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/d937d400b980523dc9ee946bb69972b5e619058d", "url": "https://api.github.com/repos/symfony/filesystem/zipball/66b769ae743ce2d13e435528fbef4af03d623e5a",
"reference": "d937d400b980523dc9ee946bb69972b5e619058d", "reference": "66b769ae743ce2d13e435528fbef4af03d623e5a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3683,7 +3753,7 @@
"description": "Provides basic utilities for the filesystem", "description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/filesystem/tree/v8.0.1" "source": "https://github.com/symfony/filesystem/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -3703,20 +3773,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-12-01T09:13:36+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v8.0.3", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12" "reference": "8da41214757b87d97f181e3d14a4179286151007"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/dd3a2953570a283a2ba4e17063bb98c734cf5b12", "url": "https://api.github.com/repos/symfony/finder/zipball/8da41214757b87d97f181e3d14a4179286151007",
"reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12", "reference": "8da41214757b87d97f181e3d14a4179286151007",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3751,7 +3821,7 @@
"description": "Finds files and directories via an intuitive fluent interface", "description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/finder/tree/v8.0.3" "source": "https://github.com/symfony/finder/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -3771,20 +3841,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-12-23T14:52:06+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v8.0.0", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "d2b592535ffa6600c265a3893a7f7fd2bad82dd7" "reference": "b48bce0a70b914f6953dafbd10474df232ed4de8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/d2b592535ffa6600c265a3893a7f7fd2bad82dd7", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b48bce0a70b914f6953dafbd10474df232ed4de8",
"reference": "d2b592535ffa6600c265a3893a7f7fd2bad82dd7", "reference": "b48bce0a70b914f6953dafbd10474df232ed4de8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3822,7 +3892,7 @@
"options" "options"
], ],
"support": { "support": {
"source": "https://github.com/symfony/options-resolver/tree/v8.0.0" "source": "https://github.com/symfony/options-resolver/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -3842,20 +3912,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-11-12T15:55:31+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-grapheme", "name": "symfony/polyfill-intl-grapheme",
"version": "v1.33.0", "version": "v1.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
"reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" "reference": "ad1b7b9092976d6c948b8a187cec9faaea9ec1df"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/ad1b7b9092976d6c948b8a187cec9faaea9ec1df",
"reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", "reference": "ad1b7b9092976d6c948b8a187cec9faaea9ec1df",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3904,7 +3974,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.36.0"
}, },
"funding": [ "funding": [
{ {
@ -3924,11 +3994,11 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-06-27T09:58:17+00:00" "time": "2026-04-10T16:19:22+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-normalizer", "name": "symfony/polyfill-intl-normalizer",
"version": "v1.33.0", "version": "v1.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@ -3989,7 +4059,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.36.0"
}, },
"funding": [ "funding": [
{ {
@ -4013,16 +4083,16 @@
}, },
{ {
"name": "symfony/polyfill-php80", "name": "symfony/polyfill-php80",
"version": "v1.33.0", "version": "v1.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php80.git", "url": "https://github.com/symfony/polyfill-php80.git",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dfb55726c3a76ea3b6459fcfda1ec2d80a682411",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4073,7 +4143,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" "source": "https://github.com/symfony/polyfill-php80/tree/v1.36.0"
}, },
"funding": [ "funding": [
{ {
@ -4093,11 +4163,11 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-01-02T08:10:11+00:00" "time": "2026-04-10T16:19:22+00:00"
}, },
{ {
"name": "symfony/polyfill-php81", "name": "symfony/polyfill-php81",
"version": "v1.33.0", "version": "v1.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php81.git", "url": "https://github.com/symfony/polyfill-php81.git",
@ -4153,7 +4223,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.33.0" "source": "https://github.com/symfony/polyfill-php81/tree/v1.36.0"
}, },
"funding": [ "funding": [
{ {
@ -4177,16 +4247,16 @@
}, },
{ {
"name": "symfony/polyfill-php84", "name": "symfony/polyfill-php84",
"version": "v1.33.0", "version": "v1.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php84.git", "url": "https://github.com/symfony/polyfill-php84.git",
"reference": "d8ced4d875142b6a7426000426b8abc631d6b191" "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191", "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/88486db2c389b290bf87ff1de7ebc1e13e42bb06",
"reference": "d8ced4d875142b6a7426000426b8abc631d6b191", "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4233,7 +4303,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php84/tree/v1.33.0" "source": "https://github.com/symfony/polyfill-php84/tree/v1.36.0"
}, },
"funding": [ "funding": [
{ {
@ -4253,20 +4323,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-06-24T13:30:11+00:00" "time": "2026-04-10T18:47:49+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v8.0.3", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "0cbbd88ec836f8757641c651bb995335846abb78" "reference": "cb8939aff03470d1a9d1d1b66d08c6fa71b3bbdc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/0cbbd88ec836f8757641c651bb995335846abb78", "url": "https://api.github.com/repos/symfony/process/zipball/cb8939aff03470d1a9d1d1b66d08c6fa71b3bbdc",
"reference": "0cbbd88ec836f8757641c651bb995335846abb78", "reference": "cb8939aff03470d1a9d1d1b66d08c6fa71b3bbdc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4298,7 +4368,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v8.0.3" "source": "https://github.com/symfony/process/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -4318,7 +4388,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-12-19T10:01:18+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
@ -4409,16 +4479,16 @@
}, },
{ {
"name": "symfony/stopwatch", "name": "symfony/stopwatch",
"version": "v8.0.0", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/stopwatch.git", "url": "https://github.com/symfony/stopwatch.git",
"reference": "67df1914c6ccd2d7b52f70d40cf2aea02159d942" "reference": "85954ed72d5440ea4dc9a10b7e49e01df766ffa3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/67df1914c6ccd2d7b52f70d40cf2aea02159d942", "url": "https://api.github.com/repos/symfony/stopwatch/zipball/85954ed72d5440ea4dc9a10b7e49e01df766ffa3",
"reference": "67df1914c6ccd2d7b52f70d40cf2aea02159d942", "reference": "85954ed72d5440ea4dc9a10b7e49e01df766ffa3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4451,7 +4521,7 @@
"description": "Provides a way to profile code", "description": "Provides a way to profile code",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/stopwatch/tree/v8.0.0" "source": "https://github.com/symfony/stopwatch/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -4471,20 +4541,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-08-04T07:36:47+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v8.0.1", "version": "v8.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc" "reference": "ae9488f874d7603f9d2dfbf120203882b645d963"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc", "url": "https://api.github.com/repos/symfony/string/zipball/ae9488f874d7603f9d2dfbf120203882b645d963",
"reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc", "reference": "ae9488f874d7603f9d2dfbf120203882b645d963",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4541,7 +4611,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v8.0.1" "source": "https://github.com/symfony/string/tree/v8.0.8"
}, },
"funding": [ "funding": [
{ {
@ -4561,7 +4631,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-12-01T09:13:36+00:00" "time": "2026-03-30T15:14:47+00:00"
}, },
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",

@ -0,0 +1,11 @@
<?php
function foo()
{
global $argv;
var_dump($argv);
var_dump(STDOUT);
}
function main(int $argc, array $argv): void
{
foo();
}

@ -12,6 +12,7 @@ use MJS\TopSort\Implementations\StringSort;
use PhpAot\Php\Entity\ClassDef; use PhpAot\Php\Entity\ClassDef;
use PhpAot\Php\Entity\ConstantDef; use PhpAot\Php\Entity\ConstantDef;
use PhpAot\Php\Entity\FunctionDef; use PhpAot\Php\Entity\FunctionDef;
use PhpAot\Php\Entity\InterfaceDef;
use PhpAot\Php\Entity\MethodDef; use PhpAot\Php\Entity\MethodDef;
use PhpAot\Php\Entity\PropertyDef; use PhpAot\Php\Entity\PropertyDef;
use PhpAot\Php\Exception\SyntaxError; use PhpAot\Php\Exception\SyntaxError;
@ -128,6 +129,9 @@ class Preprocessor extends CompilerBase
case 'Stmt_Trait': case 'Stmt_Trait':
$this->prepareClass($v); $this->prepareClass($v);
break; break;
case 'Stmt_Interface':
$this->parseInterface($v);
break;
case 'Stmt_Function': case 'Stmt_Function':
$this->prepareFunction($v); $this->prepareFunction($v);
break; break;
@ -135,7 +139,6 @@ class Preprocessor extends CompilerBase
$this->parseUse($v); $this->parseUse($v);
break; break;
case 'Stmt_Declare': case 'Stmt_Declare':
case 'Stmt_Interface':
case 'Stmt_Nop': case 'Stmt_Nop':
break; break;
case 'Stmt_Const': case 'Stmt_Const':
@ -208,7 +211,9 @@ class Preprocessor extends CompilerBase
$this->parseUse($v2); $this->parseUse($v2);
break; break;
case 'Stmt_Const': case 'Stmt_Const':
break;
case 'Stmt_Interface': case 'Stmt_Interface':
$this->parseInterface($v2);
break; break;
default: default:
$this->foundStrayCode($v2); $this->foundStrayCode($v2);
@ -613,6 +618,16 @@ class Preprocessor extends CompilerBase
$this->resetMethod(); $this->resetMethod();
} }
protected function parseInterface(Node\Stmt\Interface_ $v): void
{
$name = $this->parseIdentifier($v->name);
$this->interface = $name;
$this->interfaceDef = new InterfaceDef($name, $this->namespace);
$interfaceName = $this->interfaceDef->getNamespacedName();
$this->interfaces[$this->escapeClass($interfaceName)] = $this->interfaceDef;
$this->interfacesDefineInFile[$interfaceName] = $this->interfaceDef;
}
protected function parseTraitUseOptions(Node\Stmt\TraitUse $traitUse, array &$aliases, array &$ignored): void protected function parseTraitUseOptions(Node\Stmt\TraitUse $traitUse, array &$aliases, array &$ignored): void
{ {
foreach ($traitUse->adaptations as $adaptation) { foreach ($traitUse->adaptations as $adaptation) {

@ -30,7 +30,6 @@ class Translator extends Preprocessor
{ {
public const string VERSION = '0.1.0'; public const string VERSION = '0.1.0';
public const string APP_NAME = 'Swoole-Compiler (AOT)'; public const string APP_NAME = 'Swoole-Compiler (AOT)';
protected string $targetName = 'app'; protected string $targetName = 'app';
protected array $sourceDirs = []; protected array $sourceDirs = [];
protected bool $verbose = false; protected bool $verbose = false;
@ -857,7 +856,6 @@ class Translator extends Preprocessor
$this->parseConstDef($v); $this->parseConstDef($v);
break; break;
case 'Stmt_Interface': case 'Stmt_Interface':
$this->parseInterface($v);
break; break;
case 'Stmt_Nop': case 'Stmt_Nop':
break; break;
@ -991,7 +989,6 @@ class Translator extends Preprocessor
$code .= $this->parseUse($v2) . PHP_EOL; $code .= $this->parseUse($v2) . PHP_EOL;
break; break;
case 'Stmt_Interface': case 'Stmt_Interface':
$this->parseInterface($v2);
break; break;
default: default:
abort($v2); abort($v2);
@ -1148,6 +1145,14 @@ class Translator extends Preprocessor
} }
} }
if (is_array($this->classDef->implements)) {
foreach ($this->classDef->implements as $interfaceName) {
if (!$this->hasInterface($interfaceName) and !$this->isInternalInterface($interfaceName)) {
$this->fatalError($class, "Class `{$this->class}` implements a non-existent interface `{$interfaceName}`");
}
}
}
$className = $this->classDef->getNamespacedName(); $className = $this->classDef->getNamespacedName();
$this->classesDefineInFile[$className] = $this->classDef; $this->classesDefineInFile[$className] = $this->classDef;
@ -1456,16 +1461,6 @@ class Translator extends Preprocessor
} }
} }
protected function parseInterface(Node\Stmt\Interface_ $v): void
{
$name = $this->parseIdentifier($v->name);
$this->interface = $name;
$this->interfaceDef = new InterfaceDef($name, $this->namespace);
$interfaceName = $this->interfaceDef->getNamespacedName();
$this->interfaces[$this->escapeClass($interfaceName)] = $this->interfaceDef;
$this->interfacesDefineInFile[$interfaceName] = $this->interfaceDef;
}
protected function parseForeachObject(Foreach_ $node): string protected function parseForeachObject(Foreach_ $node): string
{ {
$obj = $this->parseIdentifier($node->expr); $obj = $this->parseIdentifier($node->expr);

@ -57,6 +57,50 @@ void php_restore_scope(php::Scope &ori_scope) {
ori_scope.frame->func->common.scope = ori_scope.ce; ori_scope.frame->func->common.scope = ori_scope.ce;
} }
static php_stream *s_in_process = NULL;
static void cli_register_file_handles(void) {
php_stream *s_in, *s_out, *s_err;
php_stream_context *sc_in = NULL, *sc_out = NULL, *sc_err = NULL;
zend_constant ic, oc, ec;
s_in = php_stream_open_wrapper_ex("php://stdin", "rb", 0, NULL, sc_in);
s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out);
s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err);
/* Release stream resources, but don't free the underlying handles. Otherwise,
* extensions which write to stderr or company during mshutdown/gshutdown
* won't have the expected functionality.
*/
if (s_in) s_in->flags |= PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE;
if (s_out) s_out->flags |= PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE;
if (s_err) s_err->flags |= PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE;
if (s_in == NULL || s_out == NULL || s_err == NULL) {
if (s_in) php_stream_close(s_in);
if (s_out) php_stream_close(s_out);
if (s_err) php_stream_close(s_err);
return;
}
s_in_process = s_in;
php_stream_to_zval(s_in, &ic.value);
php_stream_to_zval(s_out, &oc.value);
php_stream_to_zval(s_err, &ec.value);
Z_CONSTANT_FLAGS(ic.value) = 0;
ic.name = zend_string_init_interned("STDIN", sizeof("STDIN") - 1, 0);
zend_register_constant(&ic);
Z_CONSTANT_FLAGS(oc.value) = 0;
oc.name = zend_string_init_interned("STDOUT", sizeof("STDOUT") - 1, 0);
zend_register_constant(&oc);
Z_CONSTANT_FLAGS(ec.value) = 0;
ec.name = zend_string_init_interned("STDERR", sizeof("STDERR") - 1, 0);
zend_register_constant(&ec);
}
void module_shutdown(zend_module_entry *module) { void module_shutdown(zend_module_entry *module) {
/** /**
* There is a bug in PHP's handling of internal strings. All interned strings are released in the request shutdown * There is a bug in PHP's handling of internal strings. All interned strings are released in the request shutdown
@ -85,6 +129,7 @@ int main(int cpp_argc, char **cpp_argv) {
zend_first_try { zend_first_try {
try { try {
char path_translated[] = "embed"; char path_translated[] = "embed";
cli_register_file_handles();
SG(request_info).path_translated = path_translated; SG(request_info).path_translated = path_translated;
module->request_startup_func(module->type, module->module_number); module->request_startup_func(module->type, module->module_number);
} catch (zend_object *e) { } catch (zend_object *e) {

@ -119,7 +119,7 @@ foreach ($this->functions as $functionDef):
// clang-format on // clang-format on
PHP_MINIT_FUNCTION(<?=$this->getModuleName()?>) { PHP_MINIT_FUNCTION(<?=$this->getModuleName()?>) {
zend_first_try { zend_try {
// class/interface class entries // class/interface class entries
<?=$this->genClassPropertyInit()?> <?=$this->genClassPropertyInit()?>

Loading…
Cancel
Save