Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with PHP 8.1.3 #562

Open
jayray-git opened this issue Mar 10, 2022 · 13 comments
Open

Errors with PHP 8.1.3 #562

jayray-git opened this issue Mar 10, 2022 · 13 comments

Comments

@jayray-git
Copy link

Getting a plethora of errors with PHP 8.1.3. Its in Main.php and Session_database_driver.php

`
A PHP Error was encountered
Severity: 8192

Message: Return type of CI_Session_database_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_database_driver.php

Line Number: 129

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: Return type of CI_Session_database_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_database_driver.php

Line Number: 280

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: Return type of CI_Session_database_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_database_driver.php

Line Number: 151

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: Return type of CI_Session_database_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_database_driver.php

Line Number: 208

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: Return type of CI_Session_database_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_database_driver.php

Line Number: 297

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: Return type of CI_Session_database_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_database_driver.php

Line Number: 335

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 282

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 294

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 304

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 314

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 315

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 316

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 317

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 375

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 110

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: session_start(): Session cannot be started after headers have already been sent

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 98
Function: library

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: stristr(): Passing null to parameter #1 ($haystack) of type string is deprecated

Filename: controllers/Main.php

Line Number: 269

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 269
Function: stristr

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: stristr(): Passing null to parameter #1 ($haystack) of type string is deprecated

Filename: controllers/Main.php

Line Number: 297

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 297
Function: stristr

File: /public/www/paste/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: stristr(): Passing null to parameter #1 ($haystack) of type string is deprecated

Filename: controllers/Main.php

Line Number: 321

Backtrace:

File: /public/www/paste/application/controllers/Main.php
Line: 321
Function: stristr

File: /public/www/paste/index.php
Line: 315
Function: require_once

`

@jayray-git
Copy link
Author

jayray-git commented Mar 10, 2022

Temp fix if using mysql
application/config/stikked.php
$config['db_driver'] = 'mysqli';

and for lines 129,151,208,280,297,335 in system/libraries/Session/drivers/Session_database_driver.php I just inserted the following before each function as a temp fix.
#[\ReturnTypeWillChange]

*there is still other things broke, but this is a start.

@elyograg
Copy link

Thanks for that info on getting rid of errors. That was very helpful.

After doing those changes, I found that the captcha showed a broken image. Switching it to reCaptcha fixed that.

Then I found that when submitting a new paste, it threw another error. The fix is to edit system/core/Input.php (uppercase i in the filename) and edit line 568, changing it so it says "$which = FILTER_DEFAULT;" instead of setting it to NULL.

@elyograg
Copy link

Has the repo been updated so it works with PHP 8.1 without the manual code edits that are mentioned on this issue?

@elyograg
Copy link

There have been no commits pushed to this repo in nearly 3 years, so I think that no changes have been made.

@jlpoolen
Copy link

I, too, am having error messages such as the above using PHP 8.1.12. I've used this software on several machines for several years, but not recently. It looks like PHP 8.1.x has changes that have broken this project's code. Alas.

@tcreek
Copy link

tcreek commented Aug 19, 2024

Abandonware at this point

@jlpoolen
Copy link

I think I fixed most of the problems, thought there may be one lingering, but not a show-stopper, just occasional warning messages as it renders.
I use this almost daily... love it, especially for keeping a searchable log of my sessions with ChatGPT. I think I forked the project, but I am so clumsy when it comes to working with GitHub and pushing something back up, the security precautions really make it difficult.

@tcreek
Copy link

tcreek commented Aug 19, 2024

There are sources out there which will tell you what changes you need to make to update the code. Some will even automatically run through it and make the changes for you. Looks like Code Igniter needs to be updated also

@tcreek
Copy link

tcreek commented Aug 19, 2024

It has CodeIgniter 3.1.9 which is for PHP v5.6.- v7.3. Version 4 is out and good for PHP v7.4 and up to v8.2

@jlpoolen
Copy link

It appears I have already pushed my changes up to GitHub:

ares /usr/local/src/Stikked # git push origin master
Username for 'https://github.com': jlpoolen
Password for 'https://[email protected]':
Everything up-to-date
ares /usr/local/src/Stikked # date
Sun Aug 18 21:31:28 PDT 2024
ares /usr/local/src/Stikked #

So, anyone who wants to give it a try is welcomed. I cannot provide warranty service, I just hacked until it worked again.

@MercanoGlobal
Copy link

MercanoGlobal commented Sep 18, 2024

Please note that the project was continued here: https://github.com/MercanoGlobal/SNIP
It's a major rewrite that should fix all issues in the previous versions and adds a lot of new improvements like file uploads for pastes.

Your feedback is greatly appreciated.

@jlpoolen
Copy link

Please note that the project was continued here: https://github.com/MercanoGlobal/SNIP It's a major rewrite that should fix all issues in the previous versions and adds a lot of new improvements like file uploads for pastes.

Your feedback is greatly appreciated.

I think it more accurate to state the Stikked project has been forked into a project named SNIP. https://github.com/claudehohl/Stikked has no mention of the Stikked project being continued.

Can the database for Stikked be used by SNIP? I have several year's worth of pastes which are invaluable and I'm not eager to maintain both a Stikked and a SNIP instance.

@MercanoGlobal
Copy link

@jlpoolen
It should be compatible with older releases, as from what I remember, the only database-related change we made, was to add the file column, for file uploads.
This is mentioned here: https://github.com/MercanoGlobal/SNIP?tab=readme-ov-file#upgrade-notice

You should first create a backup, test the upgrade on a development instance, and see if any issues appear.

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

No branches or pull requests

5 participants