Stikked icon indicating copy to clipboard operation
Stikked copied to clipboard

Errors with PHP 8.1.3

Open jayray-git opened this issue 2 years ago • 13 comments

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 avatar Mar 10 '22 14:03 jayray-git

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.

jayray-git avatar Mar 10 '22 17:03 jayray-git

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 avatar Apr 23 '22 19:04 elyograg

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

elyograg avatar Aug 15 '22 19:08 elyograg

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

elyograg avatar Aug 15 '22 19:08 elyograg

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.

jlpoolen avatar Jan 14 '23 17:01 jlpoolen