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

'assign_new_user_avatar' exception when passing url as $url_or_media_id with php 8 #179

Closed
1 task done
lllopo opened this issue Dec 13, 2022 · 1 comment · Fixed by #183
Closed
1 task done

'assign_new_user_avatar' exception when passing url as $url_or_media_id with php 8 #179

lllopo opened this issue Dec 13, 2022 · 1 comment · Fixed by #183
Labels
type:bug Something isn’t working.
Milestone

Comments

@lllopo
Copy link

lllopo commented Dec 13, 2022

Describe the bug

When the assign_new_user_avatar function is called with first parameter ($url_or_media_id) being an url string and not a numeric media id, the function throws and exception on line 959 when running under PHP 8 :

Uncaught TypeError: Unsupported operand types: string + int in /SomePath/simple-local-avatars/includes/class-simple-local-avatars.php:959
Stack trace:
#0 /SomePath/SimpleLocalAvatarPlugin.php(56): Simple_Local_Avatars->assign_new_user_avatar('...', 56)
...

Steps to Reproduce

  1. Call programmatically the assign_new_user_avatar like this :
global $simple_local_avatars;

if ( isset( $simple_local_avatars ) ) {
	$current_user = wp_get_current_user();
	$simple_local_avatars->assign_new_user_avatar( 'some_url_string', $current_user->ID );
}

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

Wordpress 6.1.1
PHP 8.0.15
SimpleLocalAvatars 2.7.1

Code of Conduct

  • I agree to follow this project's Code of Conduct
@lllopo lllopo added the type:bug Something isn’t working. label Dec 13, 2022
@faisal-alvi
Copy link
Member

Note: This is coming from the fix #71

@jeffpaul jeffpaul added this to the 2.8.0 milestone Jan 9, 2023
@faisal-alvi faisal-alvi modified the milestones: 2.8.0, 2.7.2 Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn’t working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants