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

Uncaught TypeError #21

Closed
ssnepenthe opened this issue May 6, 2017 · 2 comments
Closed

Uncaught TypeError #21

ssnepenthe opened this issue May 6, 2017 · 2 comments

Comments

@ssnepenthe
Copy link
Owner

Fatal error: Uncaught TypeError: Argument 1 passed to SSNepenthe\Soter\Listeners\Log_Vulnerability_Ids::log_vulnerability_ids() must be of the type array, object given, called in /srv/www/wordpress-default/public_html/wp-includes/class-wp-hook.php on line 298 and defined in /srv/www/wordpress-default/public_html/wp-content/plugins/soter/src/Listeners/class-log-vulnerability-ids.php:51

This was referenced May 6, 2017
@ssnepenthe
Copy link
Owner Author

It looks like this stems from the following lines in the definition of do_action():

if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
		$args[] =& $arg[0];

When calling do_action( 'soter_check_packages_complete', $vulnerabilities ) where $vulnerabilities is an array containing only a single Vulnerability object, WordPress is passing that object to WP_Hook::do_action() instead of the full array.

Solution is probably going to be to drop the array type hints and add conditionals to ensure we are actually working with an array.

@ssnepenthe
Copy link
Owner Author

Looks like there is already an issue filed:

https://core.trac.wordpress.org/ticket/40284

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

1 participant