codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.4k stars 1.9k forks source link

Bug: Database session handler using postgres #5570

Closed githaigamaina closed 2 years ago

githaigamaina commented 2 years ago

PHP Version

7.4

CodeIgniter4 Version

4.1.7

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

PostgreSQL14

What happened?

If the session handle is database, it throwing an error.

Steps to Reproduce

Install CI4 and use PostreSQL as the database Set the session handler to database

Expected Output

The system will use database sessions without breaking. I have to change change Vendor > Codeigniter4 >- framework > Session > Handlers > DatabaseHandler.php line line 122 to

->select($this->platform === 'postgre' ? "encode(data, 'base64') AS data" : 'data')

to

change Vendor > Codeigniter4 >- framework > Session > Handlers > DatabaseHandler.php line line 122 to

->select($this->platform === 'postgre' ? "encode(data::bytea, 'base64') AS data" : 'data')

Anything else?

I have given my solution as above.

kenjis commented 2 years ago

@githaigamaina Thank you for reporting! Why don't you send a PR? See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/README.md

kenjis commented 2 years ago

Can't reproduce on develop and postgres:13-alpine, PHP 8.0.15.

Can't reproduce onpostgres:14-alpine.

paulbalandan commented 2 years ago

It seems there is no activity for this, and not reproducible. Closing.