Closed futtta closed 6 years ago
:fearful:
It looks like something at EDD (or a fake one) is wiping our changing type of $ao_ccss_types
. This is the only possibility to this warning shows up.
Ask the user to manually add var_dump($ao_ccss_types);
just after this line and send you the result back.
I was wondering; why not move the entire block of core condtionals into the ao_cccss_extend_types() function, only leaving the intiial declaration ($ao_ccss_type=array()
) in the main part of the code (which is not hooked into a specific wordpress action/ filter, somehow I think WordPress actions and when we hook into them for ao_cccss_extend_types is part of the reason of this issue)?
Edit; I tried reproducing with EDD active, but I could not.
This (move $ao_ccss_types first declaration to ao_cccss_extend_types()) could be done, but it will not affect this so called 'bug'. Unless a third party is doing something nasty to $ao_ccss_types, it can't be empty nor anything not array.
That being said, I see two drawbacks of doing that:
So, unless you have a very good reason to change that, I advise against it. What the user reported is not enough to change such a crucial variable.
thanks for your helpful feedback Deny! :)
EDD was most definitely active with a few extensions. The funny part is it only happens once a day at a specific time, so I'm thinking a cron job running that isn't causing the second value you need to be set.
Need to change logging settings as logs didn't contain request data, but I'm 100% positive it has to be CRON related.
Thanks for following up Daniel! If you have an exact timestamp, you could use crontrol to see what runs at that time?
On Tue, Sep 11, 2018 at 11:24 PM, Daniel Iser notifications@github.com wrote:
EDD was most definitely active with a few extensions. The funny part is it only happens once a day at a specific time, so I'm thinking a cron job running that isn't causing the second value you need to be set.
Need to change logging settings as logs didn't contain request data, but I'm 100% positive it has to be CRON related.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/futtta/ao_critcss_aas/issues/66#issuecomment-420430560, or mute the thread https://github.com/notifications/unsubscribe-auth/AALEMZfbf53lFtp0Edc8CT5M6tT1abp1ks5uaCn6gaJpZM4WgALo .
That error I first reported isn't alone it appears it is accompanied every time with the following.
`[10-Sep-2018 09:02:15 UTC] PHP Warning: array_unshift() expects parameter 1 to be array, null given in wp-content/plugins/autoptimize-criticalcss/inc/core.php on line 157
[10-Sep-2018 09:02:15 UTC] PHP Warning: array_unshift() expects parameter 1 to be array, null given in wp-content/plugins/autoptimize-criticalcss/inc/core.php on line 163
[10-Sep-2018 09:02:15 UTC] PHP Warning: array_unshift() expects parameter 1 to be array, null given in wp-content/plugins/autoptimize-criticalcss/inc/core.php on line 163
[10-Sep-2018 09:02:15 UTC] PHP Warning: array_merge(): Argument #2 is not an array in wp-content/plugins/autoptimize-criticalcss/inc/core.php on line 243`
Not seeing any events at that time in cron specifically, though It may be that logs are on server time, and Control is showing WP localized time.
Different error, Identical problem; global $ao_ccss_types should be a non-empty array (as per L21-36) but is not.
The warnings from @danieliser brings some light. It looks like $ao_ccss_types comes empty from the global call in ao_ccss_extend_types(). My guess ATM: the other day you was fiddling with ao_ccss_frontend() and its priorities. It *could* be related...
the other day you was fiddling with ao_ccss_frontend() and its priorities. It could be related...
what change are you referring to @denydias ?
Oh! That's a *very* good question! Your commits lacks issues references... :stuck_out_tongue_closed_eyes:
I'll try to find it here though.
but why would it, it does not change $ao_ccss_types as array_flip does not change the original array?
I'm not saying that flip is the culprit. What I meant is that $ao_ccss_types, being the global it is and under *edgy cases* (@danieliser stated in WP's support forum that it's happening 'maybe once or twice a day'), could get empty for a reason we still don't have a clue.
This one looks a hard catch. Maybe you should accept the clone offer to put it under a heavy load plus some sort of kill switch when the warning appear. This could get you the closest to the source of the bug (if any).
What if we move the initial array creation into a function which is called from global context and also from within ao_ccss_extend_types() if $ao_ccss_types is empty or not an array?
On Wed, Sep 12, 2018 at 9:32 AM, Deny Dias notifications@github.com wrote:
I'm not saying that flip is the culprit. What I meant is that $ao_ccss_types, being the global it is and under edgy cases (@danieliser https://github.com/danieliser stated in WP's support forum that it's happening 'maybe once or twice a day'), could get empty for a reason we still don't have a clue.
This one looks a hard catch. Maybe you should accept the clone offer to put it under a heavy load plus some sort of kill switch when the warning appear. This could get you the closest to the source of the bug (if any).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/futtta/ao_critcss_aas/issues/66#issuecomment-420543263, or mute the thread https://github.com/notifications/unsubscribe-auth/AALEMcGelu7eqla1GNd8Haxu4SMrB0-Rks5uaLh2gaJpZM4WgALo .
Looks like a workaround, not a fix for the source issue. To properly fix it, we should be able to reproduce and understand what is causing it in the first place (specially because it could also affect other environments). Anything else is a hack.
let's see if @danieliser can narrow this down some more, if not we'll go with the workaround (I love my hacks ;-) )
On Wed, Sep 12, 2018 at 9:48 AM, Deny Dias notifications@github.com wrote:
Looks like a workaround, not a fix for the source issue. To properly fix it, we should be able to reproduce and understand what is causing it in the first place (specially because it could affect also other environments). Anything else is a hack.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/futtta/ao_critcss_aas/issues/66#issuecomment-420547583, or mute the thread https://github.com/notifications/unsubscribe-auth/AALEMeNMmCfdqtcGAXdpOoAF7LSuiESHks5uaLw2gaJpZM4WgALo .
I know, the same amount I hate 'em! :P
that's why we're a good team :-)
On Wed, Sep 12, 2018 at 9:56 AM, Deny Dias notifications@github.com wrote:
I know, the same amount I hate 'em! :P
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/futtta/ao_critcss_aas/issues/66#issuecomment-420549859, or mute the thread https://github.com/notifications/unsubscribe-auth/AALEMXyrHSVgefqv_y8YKJu3tIggBj1jks5uaL4TgaJpZM4WgALo .
@danieliser
pinging @danieliser :-)
Not that I'm seeing. Though if the process ran for 2-3 minutes before erroring then it could be +- a few
I can try running them all manually and see when the error comes up (or if it does).
`ao_ccss_queue | None | ao_ccss_queue_control() | 2018-09-16 16:47:46 (4 minutes 10 seconds) | Autoptimize CriticalCSS.com Power-Up Queue | Edit \ | Run Now \ | Delete |
---|---|---|---|---|---|---|---|
w3_pgcache_prime | None | W3TC\PgCache_Plugin->prime() | 2018-09-16 16:48:12 (4 minutes 36 seconds) | [W3TC] Page Cache prime (every 900 seconds) | Edit | Run Now | Delete | ||
wp_privacy_delete_old_export_files | None | wp_privacy_delete_old_export_files() | 2018-09-16 17:22:53 (39 minutes 17 seconds) | Once Hourly | Edit | Run Now | Delete | ||
wp_session_garbage_collection | None | 2018-09-16 18:46:05 (2 hours 2 minutes) | Twice Daily | Edit | Run Now | Delete | |||
monsterinsights_daily_cron | None | 2018-09-16 20:01:00 (3 hours 17 minutes) | Once Daily | Edit | Run Now | Delete | |||
delete_expired_transients | None | delete_expired_transients() | 2018-09-16 22:02:46 (5 hours 19 minutes) | Once Daily | Edit | Run Now | ||
edd_recurring_daily_scheduled_events | None | EDD_Recurring_Reminders->scheduled_reminders()EDD_Recurring_Cron->check_for_expired_subscriptions()EDD_Recurring_Cron->check_for_abandoned_subscriptions() | 2018-09-17 00:20:26 (7 hours 36 minutes) | Once Daily | Edit | Run Now | Delete | ||
wpseo-premium-prominent-words-recalculate | None | WPSEO_Premium_Prominent_Words_Recalculation_Notifier->manage_notification() | 2018-09-17 00:24:48 (7 hours 41 minutes) | Once Daily | Edit | Run Now | Delete | ||
mc4wp_refresh_mailchimp_lists | None | mc4wp_refresh_mailchimp_lists() | 2018-09-17 02:59:00 (10 hours 15 minutes) | Once Daily | Edit | Run Now | Delete | ||
ao_cachechecker | None | ao_cachechecker_cronjob() | 2018-09-17 03:06:40 (10 hours 23 minutes) | Once Daily | Edit | Run Now | Delete | ||
ao_ccss_maintenance | None | ao_ccss_cleaning() | 2018-09-17 03:17:46 (10 hours 34 minutes) | Twice Daily | Edit | Run Now | Delete | ||
wp_version_check | None | wp_version_check() | 2018-09-17 03:22:14 (10 hours 38 minutes) | Twice Daily | Edit | Run Now | ||
wp_update_plugins | None | wp_update_plugins() | 2018-09-17 03:22:14 (10 hours 38 minutes) | Twice Daily | Edit | Run Now | ||
wp_update_themes | None | wp_update_themes() | 2018-09-17 03:22:14 (10 hours 38 minutes) | Twice Daily | Edit | Run Now | ||
wpmudev_scheduled_jobs | None | WPMUDEV_Dashboard_Api->hub_sync()WPMUDEV_Dashboard_Api->refresh_projects_data() | 2018-09-17 04:01:37 (11 hours 18 minutes) | Twice Daily | Edit | Run Now | Delete | ||
mwp_update_public_keys | None | 2018-09-17 04:09:40 (11 hours 26 minutes) | Once Daily | Edit | Run Now | Delete | |||
aepc_refresh_audiences_size | None | PixelCaffeine\Job\RefreshAudiencesSize->task() | 2018-09-17 04:36:48 (11 hours 53 minutes) | Once Daily | Edit | Run Now | Delete | ||
ahoy_weekly_scheduled_events | None | Ahoy\Licensing::weekly_license_check() | 2018-09-17 04:45:18 (12 hours 1 minute) | Once Weekly | Edit | Run Now | Delete | ||
ahoy_daily_scheduled_events | None | 2018-09-17 04:45:18 (12 hours 1 minute) | Once Daily | Edit | Run Now | Delete | |||
wp_scheduled_auto_draft_delete | None | wp_delete_auto_drafts() | 2018-09-17 05:59:50 (13 hours 16 minutes) | Once Daily | Edit | Run Now | ||
wp_scheduled_delete | None | wp_scheduled_delete() | 2018-09-17 15:38:39 (22 hours 55 minutes) | Once Daily | Edit | Run Now | ||
edd_daily_scheduled_events | None | edd_cleanup_stats_transients()edd_all_access_check_expired_periods_via_cron()edd_sl_scheduled_reminders()edd_sl_check_for_expired_licenses()EDD_Jilt_Integration->update_shop() | 2018-09-17 15:53:24 (23 hours 9 minutes) | Once Daily | Edit | Run Now | Delete | ||
wpseo-reindex-links | None | WPSEO_Link_Notifier->manage_notification() | 2018-09-17 16:25:57 (23 hours 42 minutes) | Once Daily | Edit | Run Now | Delete | ||
nf_optin_cron | None | nf_optin_update_environment_vars() | 2018-09-18 06:46:05 (1 day 14 hours) | Once per month | Edit | Run Now | Delete | ||
monsterinsights_usage_tracking_cron | None | MonsterInsights_Tracking->send_checkin() | 2018-09-19 02:39:55 (2 days 9 hours) | Once Weekly | Edit | Run Now | Delete | ||
wpseo_onpage_fetch | None | WPSEO_OnPage->fetch_from_onpage() | 2018-09-22 01:04:10 (5 days 8 hours) | Once Weekly | Edit | Run Now | Delete | ||
edd_weekly_scheduled_events | None | edd_delete_saved_carts()edd_mark_abandoned_orders() | 2018-09-22 15:53:24 (5 days 23 hours) | Once Weekly | Edit | Run Now | Delete` |
Hmm, just ran them all manually and no new errors. For some reason no request url info in the log either, gonna tweak logging settings and see if that gives more info. Gonna try adding stacktrace to logs.
Got it from the access logs, definitely related to this plugin, something in the automated scans somehow. Here are the access logs from yesterday the few minutes leading up to the error time.
111.118.159.144 - - [16/Sep/2018:04:58:32 +0000] "GET / HTTP/1.0" 301 642 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
138.68.175.225 - - [16/Sep/2018:05:00:03 +0000] "GET /checkout/transaction-failed/?ao_noptimize=1 HTTP/1.0" 200 15517 "-" "https://criticalcss.com"
138.68.175.225 - - [16/Sep/2018:05:00:06 +0000] "GET /checkout/transaction-failed/?ao_noptimize=1 HTTP/1.0" 200 15359 "-" "https://criticalcss.com"
142.93.54.158 - - [16/Sep/2018:05:00:01 +0000] "GET /wp-cron.php?doing_wp_cron HTTP/1.0" 200 535 "-" "Wget/1.16 (linux-gnu)"
138.68.175.225 - - [16/Sep/2018:05:00:19 +0000] "GET /checkout/purchase-confirmation/?ao_noptimize=1 HTTP/1.0" 200 15664 "-" "https://criticalcss.com"
138.68.175.225 - - [16/Sep/2018:05:00:21 +0000] "GET /checkout/purchase-confirmation/?ao_noptimize=1 HTTP/1.0" 200 15520 "-" "https://criticalcss.com"
thanks for the detailed feedback @danieliser
4 out of 6 are actually requests from criticalcss.com and are doubles (which is weird). assuming 142.93.54.158
is the IP of your own server, I indeed think a cron job is the culprit here, but if you ran each one this remains a big mystery, hence the workaround implemented in the relevant commit :-)
@futtta Glad you got a workaround, that said crons were logged in the access logs as well, but a few minutes before & after the timestamp of the issue.
any idea regarding https://wordpress.org/support/topic/array_merge-argument-2-is-not-an-array-6/ @denydias