Skip to content

fix(prefs): resolve autoloader via composer proxy globals#10

Merged
ralflang merged 1 commit into
horde:FRAMEWORK_6_0from
jcdelepine:fix/prefs-autoload-path
Jul 1, 2026
Merged

fix(prefs): resolve autoloader via composer proxy globals#10
ralflang merged 1 commit into
horde:FRAMEWORK_6_0from
jcdelepine:fix/prefs-autoload-path

Conversation

@jcdelepine

Copy link
Copy Markdown

bin/horde-prefs computes the path to vendor/autoload.php using a fixed relative
depth from DIR. When horde/prefs is installed as a symlink to a git checkout
(composer "path" repository, as used in git developer installs), PHP resolves
DIR through the symlink target, breaking the fixed-depth assumption and causing
the script to fail with "Neither Composer nor PEAR Horde_Autoloader_Default
available" even though a valid autoloader exists.

The composer-generated bin proxy already computes the correct path via
$GLOBALS['_composer_autoload_path'] before including this script. Use it when
available, falling back to the existing depth-based paths unchanged for PEAR
installs or direct invocation outside the proxy.

Reproduced and verified fixed on a git developer install (horde/prefs
symlinked via path repository). I don't have a standard composer
(non-symlinked) install to test against. The fixed-depth path this
patch falls back to is unchanged from the existing code, and by
inspection it matches the directory structure composer produces for
a standard install (vendor/horde/prefs/bin, 4 levels from project
root) — but I haven't actually run this against one. Would
appreciate a confirmation from someone with a standard install.

Searched the entire /var/www/horde-git tree for other bin scripts sharing this
same bootstrap pattern (grep -rl 'handle "git developer install"'). One other
file matched — horde/components/bin/horde-components — but it uses a different
path structure (different depths, plus an additional config/autoload.php entry)
and serves a different purpose (build tool for the .phar, with a separate
GitHub webhook mode). Out of scope for this fix.

bin/horde-prefs computes the path to vendor/autoload.php using a
fixed relative depth from __DIR__. When horde/prefs is installed as
a symlink to a git checkout (composer "path" repository, as used in
git developer installs), PHP resolves __DIR__ through the symlink
target, breaking the fixed-depth assumption and causing the script
to fail with "Neither Composer nor PEAR Horde_Autoloader_Default
available" even though a valid autoloader exists.

The composer-generated bin proxy already computes the correct path
via $GLOBALS['_composer_autoload_path'] before including this
script. Use it when available, falling back to the existing
depth-based paths unchanged for PEAR installs or direct invocation
outside the proxy.
@ralflang ralflang merged commit 24d3695 into horde:FRAMEWORK_6_0 Jul 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants