claudehohl / Stikked

An advanced and beautiful pastebin written in PHP
992 stars 220 forks source link

Errors with PHP 8.1.3 #562

Open jayray-git opened 2 years ago

jayray-git commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

elyograg commented 2 years ago

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

jlpoolen commented 1 year ago

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 commented 2 weeks ago

Abandonware at this point

jlpoolen commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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://jlpoolen@github.com':
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.