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

YOURLS 1.8 and AuthMgrPlus produce Argument #1 ($array) must be of type array #30

Closed
Andyt8 opened this issue Feb 25, 2021 · 4 comments
Closed

Comments

@Andyt8
Copy link

Andyt8 commented Feb 25, 2021

Hello,

I upgraded to YOURLS 1.8 with PHP8. I found a problem with enabled AuthMgrPlus. The Dashboard work without problem. Also using the short url.

However, if I want to open the statistics page for a short url, I see an empty page (except background and logo). It work after disabling of AuthMgrPlus. Switching back to PHP7.4 doesn't change anything.

According to php log, I fount the following:
Got error 'PHP message: PHP Fatal error: Uncaught TypeError: sort(): Argument #1 ($array) must be of type array, null given in /user/plugins/authMgrPlus/plugin.php:171\nStack trace:\n#0

Please for response.

@Andyt8
Copy link
Author

Andyt8 commented Mar 8, 2021

It does look like that the problem isn't YOURLS 1.8 or 1.8.1- the main problem is PHP8. Some disadvantage with modern Webspace hosting. However, according to the Readme, AuthMgrPlus is only compatible with PHP7. Is there a chance, that there will be a version for PHP8?

best regards

@Andyt8
Copy link
Author

Andyt8 commented Mar 8, 2021

In detail, it has something to do with "sort( $links['plugin']);" in line 171. If I remove or set a comment for the function, I see no error and get a statistic page.

@joshp23
Copy link
Owner

joshp23 commented Mar 12, 2021

Actually, I think the issue might be related to the $links['plugins'] array on line 171 possibly being empty in your setup. Try this:
Starting at line 168

	if( empty( $links['plugins'] ) )
		yourls_add_filter( 'admin_links', 'amp_admin_links' );
		
	sort($links['plugins']);
	return $links;

With this

	if( empty( $links['plugins'] ) )
		unset($links['plugins']);
	else
		sort($links['plugins']);
	return $links;

I'm using that code right now with php8.0, and it seems to be working :)

@Andyt8
Copy link
Author

Andyt8 commented Mar 12, 2021

Perfectly, that work for me. Thank you.

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

No branches or pull requests

2 participants