Files
FOSSBilling/composer.json
T
Adam DaleyandClaude Sonnet 4.6 17b121ca51 fix(Servicedomain): require_once registrar adapter file before class_exists check (#3832)
* fix(Servicedomain): require_once registrar adapter file before class_exists check

Third-party registrar adapters uploaded after installation are absent from
Composer's static class map (generated with --optimize-autoloader), causing
class_exists() to return false even when the file is present on disk.

Mirror the pattern used by Payment adapters in ServicePayGateway: require_once
the adapter file when the class is not yet loaded, then re-check class_exists
to keep a clear error for adapters that define no class.

Fixes #3828

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv

* fix: require_once adapter/manager files before class_exists checks

Payment adapters, server managers, and the server_manager DI factory all
relied on Composer's classmap for dynamic class resolution. With
--optimize-autoloader the classmap is static, so third-party files dropped
into src/library/ after installation are invisible to class_exists().

AntLoader (removed in #3776) previously discovered these files on the fly;
this commit restores equivalent behaviour by requiring files explicitly:

- ServicePayGateway::getAdapterClassName() now checks both nested-dir and
  flat file formats before falling back, replacing the blind `include`
- Servicehosting/Service::getServerManagerConfig() require_onces the
  manager file before calling is_callable() so the class is guaranteed
  present; Server_ has no PSR-0 entry so this also fixes non-optimised builds
- di.php server_manager factory require_oncess the manager file when the
  class is absent from the classmap (adds Path import accordingly)

Registrar adapter loading was fixed separately in the prior commit.

Related to #3828

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv

* fix: address code-review findings on adapter/manager class loading

- Servicehosting getServerManagerConfig: wrap require_once in try/catch
  so a PHP parse error in a manager file returns [] instead of fataling
  the entire manager-list API call (restores old is_callable() behaviour)

- di.php server_manager factory: replace file_exists() with Symfony
  Filesystem::exists() per CLAUDE.md convention; extract the repeated
  ucfirst((string) $manager) call to a local $managerName variable; add
  Filesystem use-import alongside the existing Path import

- composer.json: add Server_ to the psr-0 autoload entries alongside
  Payment_ and Registrar_, giving server managers the same architectural
  treatment and making the require_once guards defensive fallbacks rather
  than the only load path

- ServicePayGateway getAdapterConfig: remove the redundant filesystem
  existence re-checks (lines 386-390) that duplicated what
  getAdapterClassName() just did; collapse into a single class_exists()
  guard with the user-facing :adapter placeholder message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv

* fix(tests): update ServicePayGateway tests to match refactored getAdapterConfig

After refactoring getAdapterConfig() to delegate filesystem lookups to
getAdapterClassName(), the tests were failing because:
- Three tests had atLeast()->once() expectations on filesystem->exists()
  that the method no longer calls directly
- One test expected an error message with the full class name, but the
  refactored code uses $pg->gateway (the gateway code) in the message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 00:16:11 +02:00

151 lines
4.6 KiB
JSON

{
"name": "fossbilling/fossbilling",
"description": "Free and Open Source Billing System",
"support": {
"docs": "https://docs.fossbilling.org/",
"source": "https://github.com/FOSSBilling/FOSSBilling",
"issues": "https://github.com/FOSSBilling/FOSSBilling/issues",
"chat": "https://fossbilling.org/discord"
},
"readme": "https://github.com/FOSSBilling/FOSSBilling/blob/main/README.md",
"type": "project",
"license": "Apache-2.0",
"keywords": [
"billing",
"invoice",
"client management"
],
"homepage": "https://fossbilling.org",
"scripts": {
"post-install-cmd": [
"php src/vendor/symfony/intl/Resources/bin/compress || true"
],
"test": "pest --test-directory ../tests",
"phpstan": "phpstan analyze --memory-limit=512M",
"phpstan:baseline": "phpstan analyze --generate-baseline",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"rector:check": "rector --dry-run",
"rector:fix": "rector",
"check": [
"@phpstan",
"@cs:check",
"@test"
],
"fix": [
"@rector:fix",
"@cs:fix"
]
},
"require": {
"php": ">=8.3",
"ext-curl": "*",
"ext-intl": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"ext-zlib": "*",
"dicebear/core": "^10.0",
"dicebear/styles": "^10.0",
"doctrine/orm": "^3.6",
"dompdf/dompdf": "^3.1.4",
"egulias/email-validator": "^4.0.4",
"filp/whoops": "^2.18.4",
"gabordemooij/redbean": "^5.7.5",
"io-developer/php-whois": "^4.1.10",
"league/commonmark": "^2.8",
"league/csv": "^9.28",
"liborm85/composer-vendor-cleaner": "^1.7.1",
"mattketmo/email-checker": "^3.0",
"maxmind-db/reader": "^1.13.1",
"monolog/monolog": "^3.9",
"nelexa/zip": "^4.0.2",
"php-debugbar/php-debugbar": "^3.0.0",
"php-debugbar/twig-bridge": "^2.0.0",
"phpmyadmin/motranslator": "^6.0.0",
"pimple/pimple": "^3.6",
"plesk/api-php-lib": "^2.2.1",
"prinsfrank/standards": "^3.15",
"sentry/sentry": "^4.19.1",
"stripe/stripe-php": "^20.0.0",
"symfony/cache": "^7.4.1",
"symfony/console": "^7.4.1",
"symfony/filesystem": "^7.4",
"symfony/finder": "^7.4",
"symfony/html-sanitizer": "^7.4",
"symfony/http-client": "^7.4.1",
"symfony/http-foundation": "^7.4.1",
"symfony/intl": "^7.4",
"symfony/mailer": "^7.4",
"symfony/property-access": "^7.4",
"symfony/property-info": "^7.4.1",
"symfony/rate-limiter": "^7.4",
"symfony/sendgrid-mailer": "^7.4",
"symfony/serializer": "^7.4.2",
"symfony/uid": "^7.4",
"twig/intl-extra": "^3.22.1",
"twig/markdown-extra": "^3.24",
"twig/twig": "^3.22.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.92.3",
"mockery/mockery": "^1.6",
"pestphp/pest": "^4.0",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.1.33",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"rector/rector": "^2.3"
},
"autoload": {
"psr-0": {
"Payment_": "src/library/",
"Registrar_": "src/library/",
"Server_": "src/library/"
},
"psr-4": {
"Box\\Mod\\": "src/modules/"
},
"classmap": [
"src/library/"
]
},
"config": {
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true,
"php-http/discovery": true,
"liborm85/composer-vendor-cleaner": true,
"pestphp/pest-plugin": true
},
"vendor-dir": "src/vendor"
},
"replace": {
"php-http/message-factory": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*",
"symfony/polyfill-php83": "*",
"symfony/polyfill-intl-icu": "*",
"symfony/polyfill-intl-idn": "*"
},
"extra": {
"dev-files": {
"/": [
"tests/",
"docs/",
".travis.yml",
".github/",
".devcontainer/"
],
"gabordemooij/redbean": [
"testing/"
],
"mattketmo/email-checker": [
"res/"
],
"maxmind-db/reader": [
"ext"
]
}
}
}