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

PHP 8.1/8.2 Compatibility #12011

Open
MrPetovan opened this issue Oct 17, 2022 · 88 comments
Open

PHP 8.1/8.2 Compatibility #12011

MrPetovan opened this issue Oct 17, 2022 · 88 comments
Labels
Milestone

Comments

@MrPetovan
Copy link
Collaborator

MrPetovan commented Oct 17, 2022

If you're running PHP 8.1 and higher, please post here your PHP Deprecated notices.

@MrPetovan

This comment was marked as resolved.

@nupplaphil
Copy link
Collaborator

We should consider a "maximum" php version, because the deprecation notice is impossible to fix with our current base-version. The type "mixed" isn't supported yet ;-)

@MrPetovan
Copy link
Collaborator Author

MrPetovan commented Oct 17, 2022

We can use the special attribute #[\ReturnTypeWillChange] as well. It resolves to a single line comment in PHP <8.0.

@utzer

This comment was marked as off-topic.

@MrPetovan
Copy link
Collaborator Author

Yes, please share all the Warnings (including these) and Errors from your log in #11993 and #11992 respectively.

@utzer
Copy link

utzer commented Nov 19, 2022

@MrPetovan ok, I will do so from now on.

One question, do you have a idea why avatars are often not shown? I have this since the update and it is annoying. Another problem is I can not follow any new users anymore, it will instead follow the .rss of the account, which is also really annoying.

@MrPetovan
Copy link
Collaborator Author

Which update? The last stable version isn't so stable, the develop branch has received several patches for concerning issues.

@utzer
Copy link

utzer commented Nov 19, 2022

Which update? The last stable version isn't so stable, the develop branch has received several patches for concerning issues.

I was going to ask that as well, so the current dev is better than the last stable I guess, I will switch if you say so.

Also where should I share these Deprecated errors then? In the Warnings issue?

@MrPetovan
Copy link
Collaborator Author

Deprecation errors go here because they are related to PHP 8, non-Deprecation errors go over there.

@utzer

This comment was marked as resolved.

@MrPetovan
Copy link
Collaborator Author

Thank you, this is very helpful!

@utzer

This comment was marked as off-topic.

@MrPetovan
Copy link
Collaborator Author

/authorize_interaction is a Mastodon route, please open a separate issue for it, as it isn't a PHP 8 compatibility issue nor a PHP Warning.

@utzer
Copy link

utzer commented Nov 20, 2022

/authorize_interaction is a Mastodon route, please open a separate issue for it, as it isn't a PHP 8 compatibility issue nor a PHP Warning.

Done.
#12220

@utzer

This comment was marked as outdated.

@MrPetovan
Copy link
Collaborator Author

MrPetovan commented Nov 20, 2022

So, it looks like you submitted several that should have been fixed in #12221 and friendica/friendica-addons#1315, please make sure you wipe out your log so that you don't submit duplicates.

The second list belongs here but isn't very useful without the earlier lines of the message, see #12011 (comment) for an example of complete output.

@utzer
Copy link

utzer commented Nov 20, 2022

So, it looks like you submitted several that should have been fixed in

ah sorry, my bad. I will update above after.

The second list belongs here but isn't very useful without the earlier lines of the message, see #12011 (comment) for an example of complete output.

Hmm for that other thing I am confused, I think the sed cuts off the lines, because it seems this "attribute should be used to temporarily suppress the notice " is always part of a "Deprecated" line, right?

@MrPetovan
Copy link
Collaborator Author

MrPetovan commented Nov 20, 2022

Yes but it’s leaving out several details useful to fix them, I was guessing the message was multi-line on your system.

@utzer
Copy link

utzer commented Nov 20, 2022

Yes but it’s leaving out several details useful to fix them, I was guessing the message was multi-line on your system.

no, the sed breaks the lines I think, asked on Friendica for some help to improve the sed command.

@utzer

This comment was marked as outdated.

@utzer

This comment was marked as resolved.

MrPetovan added a commit to MrPetovan/friendica-addons that referenced this issue Nov 23, 2022
…ib2_compat

- Add missing use statement in SecureTestEmail
- Hopefully address friendica/friendica#12011 (comment)
MrPetovan added a commit to MrPetovan/friendica-addons that referenced this issue Nov 23, 2022
@MrPetovan
Copy link
Collaborator Author

For the follow issue, can you please check if it's the same problem with the system account as in this issue: #12185

@AlfredSK

This comment was marked as resolved.

@MrPetovan
Copy link
Collaborator Author

We should be doing a hotfix release soon, so it's unlikely this deprecation notice will be addressed in the upcoming release.

@utzer
Copy link

utzer commented May 3, 2023

Latest stable running.

Server 1:

21132502  PHP Deprecated:  Creation of dynamic property PDOStatement::$table is deprecated in /var/www/src/Database/Database.php on line 1514
  65682  PHP Deprecated:  Implicit conversion from float 41.024992192379 to int loses precision in /var/www/addon/smileybutton/smileybutton.php on line 93
     14  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/addon/showmore/showmore.php on line 128
  13978  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Content/Text/HTML.php on line 179
   1657  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Content/Text/HTML.php on line 579
     31  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Util/ParseUrl.php on line 311

That 21132502 times are just for today, so the error in that line occurred 21132502 within the last 15h30m.

PHP: 8.2.5

It is taking a toll on my system now, often pages don't load.

Server 2:

      1  PHP Deprecated:  Creation of dynamic property Friendica\Module\Calendar\Event\Get::$app is deprecated in /var/www/src/Module/Calendar/Event/Get.php on line 54
     11  PHP Deprecated:  Creation of dynamic property Friendica\Object\Api\Mastodon\ListEntity::$replies_policy is deprecated in /var/www/src/Object/Api/Mastodon/ListEntity.php on line 49
    114  PHP Deprecated:  Creation of dynamic property Friendica\Object\Api\Mastodon\Preferences::$posting:default:language is deprecated in /var/www/src/Object/Api/Mastodon/Preferences.php on line 58
    114  PHP Deprecated:  Creation of dynamic property Friendica\Object\Api\Mastodon\Preferences::$posting:default:sensitive is deprecated in /var/www/src/Object/Api/Mastodon/Preferences.php on line 57
    114  PHP Deprecated:  Creation of dynamic property Friendica\Object\Api\Mastodon\Preferences::$posting:default:visibility is deprecated in /var/www/src/Object/Api/Mastodon/Preferences.php on line 56
    114  PHP Deprecated:  Creation of dynamic property Friendica\Object\Api\Mastodon\Preferences::$reading:expand:media is deprecated in /var/www/src/Object/Api/Mastodon/Preferences.php on line 59
    114  PHP Deprecated:  Creation of dynamic property Friendica\Object\Api\Mastodon\Preferences::$reading:expand:spoilers is deprecated in /var/www/src/Object/Api/Mastodon/Preferences.php on line 60
    307  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/addon/showmore/showmore.php on line 128
     24  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/App/Page.php on line 522
 120267  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Content/Text/HTML.php on line 179
   9344  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Content/Text/HTML.php on line 579
     13  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Util/ParseUrl.php on line 311
     16  PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/addon/openstreetmap/openstreetmap.php on line 59
      4  PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/Model/Item.php on line 3070

PHP: 8.2.5

Not sure why server 2 looks different.

@MrPetovan
Copy link
Collaborator Author

That's a new one for sure.

@annando
Copy link
Collaborator

annando commented Nov 24, 2023

Are there any compatibility issues any more? I'm running with 8.2 on my machines and I haven't got any issues.

@utzer
Copy link

utzer commented Nov 26, 2023

Are there any compatibility issues any more? I'm running with 8.2 on my machines and I haven't got any issues.

only these:

  17549  PHP Deprecated:  ctype_space(): Argument of type int will be interpreted as string in the future in /var/www/src/Content/Smilies.php on line 230
  25632  PHP Deprecated:  Implicit conversion from float 41.024992192379 to int loses precision in /var/www/addon/smileybutton/smileybutton.php on line 93
     40  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/addon/showmore/showmore.php on line 128
  15829  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Content/Text/HTML.php on line 178
   5883  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Content/Text/HTML.php on line 581
      9  PHP Deprecated:  mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /var/www/src/Util/ParseUrl.php on line 311
     30  PHP Deprecated:  mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/Protocol/ActivityPub/Processor.php on line 1731
    338  PHP Deprecated:  Optional parameter $rules declared before required parameter $configuration is implicitly treated as a required parameter in /var/www/src/Object/Api/Mastodon/Instance.php on line 87

leading number is how often the message is found in the logs today.

PHP: 8.2.12

@MrPetovan
Copy link
Collaborator Author

MrPetovan commented Nov 26, 2023

We still don't have a good solution for mb_convert_encoding but I can look into the others.

25632 PHP Deprecated: Implicit conversion from float 41.024992192379 to int loses precision in /var/www/addon/smileybutton/smileybutton.php on line 93

This was fixed in October 20th in https://git.friendi.ca/friendica/friendica-addons/pulls/1431, please pull the 2023.09-rc branch from the addon repo.

MrPetovan added a commit to MrPetovan/friendica that referenced this issue Nov 26, 2023
MrPetovan added a commit to MrPetovan/friendica that referenced this issue Nov 26, 2023
MrPetovan added a commit to MrPetovan/friendica that referenced this issue Nov 26, 2023
MrPetovan added a commit to MrPetovan/friendica that referenced this issue Nov 26, 2023
@MrPetovan MrPetovan reopened this Dec 13, 2023
@oculos

This comment was marked as resolved.

friendica pushed a commit to friendica/friendica-addons that referenced this issue Dec 20, 2023
@Mannshoch
Copy link

Mannshoch commented Dec 28, 2023

I'm on 2023.12
My hoster updated to 8.2
Now I get this error:

Deprecated: Creation of dynamic property GuzzleHttp\Psr7\LazyOpenStream::$stream is deprecated in /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/App/Page.php on line 513

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/App/Page.php on line 514

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/App/Page.php on line 521

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/App/Page.php on line 522

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/App/Page.php on line 523

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/App/Page.php on line 524

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/Core/System.php on line 291

Warning: Cannot modify header information - headers already sent by (output started at /vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php:33) in /src/Core/System.php on line 307

My hoster allow to to request for lower php versions. Do I have to do it?

[EDIT]
I found in the logs an error on updating to 2023.12 may that's the cause?:

bin/composer.phar install --no-dev

The "plesk/composer-command-info" plugin was skipped because it requires a Plugin API version ("^2.0") that does not match your Composer installation ("1.1.0"). You may need to run composer update with the "--no-plugins" option.
You are using Composer 1 which is deprecated. You should upgrade to Composer 2, see https://blog.packagist.com/deprecating-composer-1-support/
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Pac...

@MrPetovan
Copy link
Collaborator Author

Thank you for the report, I’d recommend you disable the HTML display of PHP error messages. Not sure how you can change individual php.ini configuration keys in your hoster setup but you’re looking to set the display_errors key to 0.

And the Composer deprecation warning is irrelevant (for now).

@Mannshoch
Copy link

Also since Update on my Android in the app fedilab posting not work anymore.
IMG_20231228_235752

@MrPetovan
Copy link
Collaborator Author

This is unlikely to be related to a PHP 8 deprecation issue.

@Mannshoch
Copy link

Also since Update on my Android in the app fedilab posting not work anymore.

@MrPetovan
Your proposal to deactivate display errors solved also the issue on the android app.

@MrPetovan
Copy link
Collaborator Author

So it was related after all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants