Skip to content

Conversation

@affinitytechworks
Copy link

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.

if (!$this->crypt) {
$data = $this->decode($data['settings']);
$settings = $data['settings'];
if (is_resource($settings)) {
Copy link
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.

}
else {
$this->tls = false;
$this->tls = false;
Copy link
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.

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