ReimuHakurei / phpPgAdmin

Actively maintained fork of phpPgAdmin.
GNU General Public License v2.0
102 stars 24 forks source link

php 8.2 deprecation/warnings fix #7

Closed htmltiger closed 1 year ago

ReimuHakurei commented 1 year ago

Thank you. I don't have any systems with PHP 8.2 yet to test this with, but I'll take a closer look as soon as I can get a test system running.

htmltiger commented 1 year ago

These were in input text WARNING: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in

PHP Deprecated: substr_count(): Passing null to parameter #1 ($haystack) of type string is deprecated in /classes/database/Postgres.php on line 288

Creation of dynamic property FieldDecorator::$f is deprecated in decorators.inc.php etc

ROBERT-MCDOWELL commented 1 year ago

Wouldn't be worth to create a phpPgAdmin repo out of be a fork and update also the version following php version?

ReimuHakurei commented 1 year ago

The messages:

WARNING: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in

PHP Deprecated: substr_count(): Passing null to parameter #1 ($haystack) of type string is deprecated in /classes/database/Postgres.php on line 288

...which you refer to are changes which were made with PHP 8.1, and I have not personally encountered error messages in PHP 8.1 for those. What actions are you taking which are resulting in those messages, so I may debug this better?

The Creation of dynamic property FieldDecorator::$f is deprecated warning is a change in PHP 8.2+, though, I'll add your fix for that. I just want to make sure the issue for the other ones aren't some deeper problem I need to look more in to.

htmltiger commented 1 year ago

substr_count() and htmlentities() expects string parameters but when the data is null for any reasons the warning appears if error_reporting(E_ALL); (default) the error will come.

To convert null to string I added empty string at the end to make the function happy.

more info https://stackoverflow.com/a/74069811

Edit: you should get warning when you go to alter any tables column name

PHP Deprecated:  htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /colproperties.php on line 131
ReimuHakurei commented 1 year ago

Since I never came back and updated the status here... It looks like the most severe PHP 8.2 issues are with ADOdb, so I will wait for ADOdb v5.22.5 to release before looking too much further into the PHP 8.2 bugs.

ReimuHakurei commented 1 year ago

https://github.com/ADOdb/ADOdb/pull/920

Just submitted this PR to ADOdb that should fix most of this.

ReimuHakurei commented 1 year ago

I think that should be it -- as soon as the next ADOdb update comes out, we should be good for PHP 8.2.

ReimuHakurei commented 1 year ago

Fixed in v7.14.4-mod.