Skip to content

fix: Rename PEAR shim class to PearCompat - #7

Merged
ralflang merged 1 commit into
horde:FRAMEWORK_6_1from
neuhaus:fix/pear-class-case-collision
Dec 5, 2026
Merged

ralflang merged 1 commit into
horde:FRAMEWORK_6_1from
neuhaus:fix/pear-class-case-collision

Conversation

@neuhaus

@neuhaus neuhaus commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Horde\Exception\PEAR (src/PEAR.php) and Horde\Exception\Pear (src/Pear.php) are the same class name in PHP, which treats class names case-insensitively. Whichever is loaded first wins: after the global PEAR shim has loaded Horde\Exception\PEAR, Horde\Exception\Pear::catchError() is undefined, and the reverse order breaks PEAR::raiseError().

On case-insensitive filesystems (macOS, Windows) the two files are also the same path, so every checkout shows a modified file and Composer refuses to update source installs ("has uncommitted changes").

The shim is now Horde\Exception\PearCompat. The global PEAR class keeps its name and API. A new test uses the shim and Pear in one process; it fails on the current branch with "Call to undefined method Horde\Exception\PEAR::catchError()".

The only direct user of Horde\Exception\PEAR in the horde organization is horde/Form, which can switch to the global PEAR class independently of this change: horde/Form#47

Horde\Exception\PEAR and Horde\Exception\Pear are the same class name in
PHP, which treats class names case-insensitively. Whichever loads first
wins: once the global PEAR shim has loaded Horde\Exception\PEAR,
Horde\Exception\Pear::catchError() is undefined, and the reverse order
breaks PEAR::raiseError(). On case-insensitive filesystems (macOS,
Windows) src/PEAR.php and src/Pear.php are also the same file, so a
checkout shows a modified file and Composer refuses to update a source
install.

The shim is now Horde\Exception\PearCompat in src/PearCompat.php. The
global PEAR class in compat/ extends it and keeps its name and API.
@ralflang

ralflang commented Dec 5, 2026

Copy link
Copy Markdown
Member

Thank you for reporting. However it triggers the question: Where do you encounter pear errors / pear exceptions in production?

@ralflang
ralflang self-requested a review December 5, 2026 12:50
@neuhaus

neuhaus commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

I have a project using Imap_Client and ran composer update after switching to FRAMEWORK_6_1, but it wouldn't overwrite vendor/horde/exception. That package had been installed from a git checkout, and git status showed src/Pear.php as modified, although nobody had edited it.
Since horde/exception contains both src/PEAR.php and src/Pear.php on macOS's case-insensitive filesystem the two can't exist side by side, so one file overwrote the other on checkout.

@ralflang
ralflang merged commit c2adaf7 into horde:FRAMEWORK_6_1 Dec 5, 2026
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