Git-updater: Notices piling up in Apache2 logs

Created on 10 May 2020  路  15Comments  路  Source: afragen/git-updater

PHP Warning: array_merge(): Argument #1 is not an array in /var/www/html/wp-content/plugins/github-updater/src/GitHub_Updater/API.php on line 629

Thousands of above warnings are piling up in my logs. Could an check be added, or the issue (if any) be fixed?

All 15 comments

I have the same problem, it exploded my free quotas on sentry.io so i'm off for 1 month but good if it can be fixed.

I realized i was on the develop branch but switch back now to master, though it probably won't differ for that problem. I think it can be reproduced quite easily. If it helps i have all the calling stack though.

$auth_header     = $this->add_auth_header( [], $asset ); <--- returns null 
$octet_stream    = [ 'accept' => 'application/octet-stream' ]; 
$args['headers'] = array_merge( $auth_header['headers'], $octet_stream ); <--- the first array is null

I didn't seem this on any on my sites but I'll look into it today.

@herrvigg a stack trace is always appreciated.

The problem is pointed above, it is more informative than the stack call:

ErrorException: array_merge(): Expected parameter 1 to be an array, null given
#15 wp-content/plugins/github-updater/src/GitHub_Updater/API.php(629): handleError
#14 /var/local/raven-php/lib/Raven/ErrorHandler.php(0): array_merge
#13 wp-content/plugins/github-updater/src/GitHub_Updater/API.php(629): get_release_asset_redirect
#12 wp-content/plugins/github-updater/src/GitHub_Updater/API/GitHub_API.php(137): construct_download_link
#11 wp-content/plugins/github-updater/src/GitHub_Updater/Base.php(306): get_remote_repo_meta
#10 wp-content/plugins/github-updater/src/GitHub_Updater/Plugin.php(244): get_remote_plugin_meta
#9 wp-content/plugins/github-updater/src/GitHub_Updater/Base.php(176): get_meta_plugins
#8 wp-content/plugins/github-updater/src/GitHub_Updater/Base.php(166): load
#7 wp-includes/class-wp-hook.php(287): apply_filters
#6 wp-includes/class-wp-hook.php(311): do_action
#5 wp-includes/plugin.php(478): do_action
#4 wp-settings.php(540): require_once
#3 wp-config.php(55): require_once
#2 wp-load.php(37): require_once
#1 wp-blog-header.php(13): require
#0 index.php(17): null

These are the values before the last call:

asset | https://api.github.com/repos/afragen/github-updater/releases/assets/20577892
-- | --
auth_header | None
aws | true
octet_stream | {accept: application/octet-stream}
response | false

Can you test this in the current release? I thought I fixed this in https://github.com/afragen/github-updater/commit/c09a5071946020c7e735b85bc1fd4e66655b9828#diff-b300da5aa31d7fa85bb219da723e690e

What version of the plugin are y'all using?

Now it's a bit difficult to tell which version i was using because i updated right after seeing the error logs. And since i have run out of sentry quota i won't be able to validate this easily.

I was on the develop branch but the strange thing is that the logs mention the master branch. Maybe the reason is that the Repository Branch field was (and still is) left empty in the query options. Perhaps that explains something?

For now i switched to master but the fix seems to be for develop. Maybe the issue was only in develop?

What should we use now, master or develop?

About the Repository Branch (Settings Github Updater / Install Plugin), i realize now it was certainly inconsistent, being on develop but querying for master. Shouldn't it rather check the current branch as default when left empty (instead of master), if you can detect the version installed locally?

Can you test this in the current release? I thought I fixed this in c09a507#diff-b300da5aa31d7fa85bb219da723e690e

Anyway the fix itself looks good, i see no reason why this would not work since it's right before the last return. The first would return the called argument which is also an empty array so this has to work in any case.

That fix is in release 9.5.1 and higher.

Thanks, will try this week!

Can we close this issue now?

Will check tonight, sorry for the delay.

I think it is working, no log entries so far.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

klihelp picture klihelp  路  4Comments

warudin picture warudin  路  7Comments

jasonjersey picture jasonjersey  路  3Comments

therealgilles picture therealgilles  路  4Comments

PthPndr picture PthPndr  路  11Comments