Skip to content

fix(module/config): read postgres byte streams before decryption - #1772

Draft
affinitytechworks wants to merge 2 commits into
cypht-org:masterfrom
affinitytechworks:fix-postgres-blob
Draft

affinitytechworks wants to merge 2 commits into
cypht-org:masterfrom
affinitytechworks:fix-postgres-blob

Conversation

@affinitytechworks

Copy link
Copy Markdown

PostgreSQL can hand hm_user_settings.settings back as a stream resource when PDO is built with libpq support. Passing that resource straight into base64_decode() causes a PHP 8 fatal error before libsodium gets a chance to decrypt the payload. Normalizing the value with stream_get_contents() ensures the stored settings are always a string before decode/decrypt, which allows users to log in again.

Comment thread lib/config.php
if (!$this->crypt) {
$data = $this->decode($data['settings']);
$settings = $data['settings'];
if (is_resource($settings)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this at the place where stream is defined/used? It seems awkward to work with streams here. THis method should receive a string.

Comment thread modules/smtp/hm-smtp.php
}
else {
$this->tls = false;
$this->tls = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be part of another PR (which I already merged). Can you push one change at a time to a PR? Thanks.

@marclaporte

Copy link
Copy Markdown
Member

@affinitytechworks We need you :-)

@IrAlfred

IrAlfred commented Nov 28, 2025

Copy link
Copy Markdown
Member

Seems related to #1790

@marclaporte

Copy link
Copy Markdown
Member

@affinitytechworks we need you :-)

@affinitytechworks

affinitytechworks commented Jan 14, 2026 via email

Copy link
Copy Markdown
Author

@marclaporte

Copy link
Copy Markdown
Member

No problem. Please just come back when you can :-)

@marclaporte

Copy link
Copy Markdown
Member

@affinitytechworks Not a particular rush but should be handled at one point :-)

@marclaporte
marclaporte marked this pull request as draft July 17, 2026 17:28
@marclaporte

Copy link
Copy Markdown
Member

I converted this PR to draft because of lack of activity

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.

4 participants