Skip to content

refactor(deps): move phpseclib to 3rdparty scoped vendor#7801

Merged
vitormattos merged 10 commits into
mainfrom
feat/phpseclib-via-3rdparty
Jun 17, 2026
Merged

refactor(deps): move phpseclib to 3rdparty scoped vendor#7801
vitormattos merged 10 commits into
mainfrom
feat/phpseclib-via-3rdparty

Conversation

@vitormattos

Copy link
Copy Markdown
Member

Summary

Migrates phpseclib from a direct Composer dependency to the scoped 3rdparty vendor bundle.

Background

phpseclib was previously installed directly via Composer as phpseclib/phpseclib. This created a namespace collision risk and was inconsistent with how other vendor libraries are handled. All vendor dependencies used by LibreSign should be scoped through LibreSign/3rdparty to avoid conflicts.

The 3rdparty bundle uses PHP-Scoper to rewrite all class namespaces to OCA\Libresign\Vendor\.

Changes

  • composer.json/composer.lock: remove phpseclib/phpseclib direct dependency
  • scoper.inc.php: remove phpseclib patcher (it's now in 3rdparty's scoper.inc.php)
  • 6 files: update all namespace references from phpseclib3\OCA\Libresign\Vendor\phpseclib3\
    • lib/Handler/SignEngine/TSA.php
    • lib/Handler/SignEngine/Pkcs12Handler.php
    • lib/Handler/CertificateEngine/AEngineHandler.php (inline FQCNs)
    • lib/Service/Install/SignSetupService.php
    • lib/Command/Developer/SignSetup.php
    • tests/php/Unit/Handler/SignEngine/TSATest.php

Related

phpseclib/phpseclib is now provided by the 3rdparty scoped vendor bundle
(LibreSign/3rdparty) rather than as a direct Composer dependency.

Changes:
- Remove phpseclib/phpseclib from composer.json/composer.lock
- Remove phpseclib patcher from scoper.inc.php (now in 3rdparty)
- Update all namespace imports from 'phpseclib3\' to
  'OCA\Libresign\Vendor\phpseclib3\' in:
  - lib/Handler/SignEngine/TSA.php
  - lib/Handler/SignEngine/Pkcs12Handler.php
  - lib/Handler/CertificateEngine/AEngineHandler.php (inline FQCNs)
  - lib/Service/Install/SignSetupService.php
  - lib/Command/Developer/SignSetup.php
  - tests/php/Unit/Handler/SignEngine/TSATest.php

The 3rdparty update is tracked in LibreSign/3rdparty#65.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in Roadmap Jun 16, 2026
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Point 3rdparty submodule to LibreSign/3rdparty#65 (feat/add-phpseclib)
which includes the scoped phpseclib/phpseclib 3.0.55 vendor artifacts.

This will be updated to the merged main commit once 3rdparty PR#65 is
merged.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…tcher

Points to fixed commit 54f5e8c that correctly scopes phpseclib3 dynamic
class name strings using the post-scoper double-backslash patterns.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
twig, mpdf, and smalot/pdfparser were migrated to the scoped 3rdparty
vendor bundle. The libresign scoper only processes its local vendor/,
which no longer contains these packages. The patchers were dead code.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The Playwright container (mcr.microsoft.com/playwright:v1.59.1-noble) does
not include libgd.so.3 or libc-client.so.2007e, causing PHP's gd and imap
extensions to fail on startup. This prevents occ maintenance:install from
running (Nextcloud requires GD).

Install the system libraries before setup-php and add imap to the PHP
extensions list.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Remove manual apt install of libgd3 and libc-client2007e.
shivammathur/setup-php installs system dependencies automatically
when extensions are listed — gd and imap are already declared.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
setup-php reports gd/imap as Enabled because the .so files are present
in the Playwright container, but does not install the underlying system
libraries (libgd3, libc-client2007e) that the .so files depend on.
Install them explicitly so PHP can actually load the extensions.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
All packages that required scoping (mpdf, twig, smalot/pdfparser,
phpseclib) have been migrated to the LibreSign/3rdparty bundle where
scoping is handled centrally.

libresign's local vendor/ now only contains jeidison/signer-php (used
directly with its own namespace) and psr/ (Nextcloud-provided).
lib/Vendor is never built, not tracked in git, and not referenced in
autoload. The scoper infrastructure is entirely dead code.

Remove scoper.inc.php and vendor-bin/php-scoper/.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos

Copy link
Copy Markdown
Member Author

/backport to stable34

@vitormattos

Copy link
Copy Markdown
Member Author

/backport to stable33

@vitormattos

Copy link
Copy Markdown
Member Author

/backport to stable32

@vitormattos vitormattos merged commit 1297e2b into main Jun 17, 2026
75 checks passed
@vitormattos vitormattos deleted the feat/phpseclib-via-3rdparty branch June 17, 2026 16:38
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in Roadmap Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

1 participant