Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upArgument #2 is not an array /wp-content/plugins/autoptimize-criticalcss/inc/core.php: 243 #66
Comments
This comment has been minimized.
This comment has been minimized.
It looks like something at EDD (or a fake one) is wiping our changing type of Ask the user to manually add |
This comment has been minimized.
This comment has been minimized.
I was wondering; why not move the entire block of core condtionals into the ao_cccss_extend_types() function, only leaving the intiial declaration ( Edit; I tried reproducing with EDD active, but I could not. |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
thanks for your helpful feedback Deny! :) |
This comment has been minimized.
This comment has been minimized.
danieliser
commented
Sep 11, 2018
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. |
This comment has been minimized.
This comment has been minimized.
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 ***@***.***> 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
<#66 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALEMZfbf53lFtp0Edc8CT5M6tT1abp1ks5uaCn6gaJpZM4WgALo>
.
|
This comment has been minimized.
This comment has been minimized.
danieliser
commented
Sep 12, 2018
•
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. |
This comment has been minimized.
This comment has been minimized.
Different error, Identical problem; global $ao_ccss_types should be a non-empty array (as per L21-36) but is not. |
This comment has been minimized.
This comment has been minimized.
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... |
This comment has been minimized.
This comment has been minimized.
what change are you referring to @denydias ? |
This comment has been minimized.
This comment has been minimized.
Oh! That's a *very* good question! Your commits lacks issues references... I'll try to find it here though. |
This comment has been minimized.
This comment has been minimized.
Maybe this? |
This comment has been minimized.
This comment has been minimized.
but why would it, it does not change $ao_ccss_types as array_flip does not change the original array? |
This comment has been minimized.
This comment has been minimized.
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). |
This comment has been minimized.
This comment has been minimized.
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 ***@***.***> 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* ***@***.***
<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
<#66 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALEMcGelu7eqla1GNd8Haxu4SMrB0-Rks5uaLh2gaJpZM4WgALo>
.
|
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
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 ***@***.***> 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
<#66 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALEMeNMmCfdqtcGAXdpOoAF7LSuiESHks5uaLw2gaJpZM4WgALo>
.
|
This comment has been minimized.
This comment has been minimized.
I know, the same amount I hate 'em! :P |
This comment has been minimized.
This comment has been minimized.
that's why we're a good team :-)
…On Wed, Sep 12, 2018 at 9:56 AM, Deny Dias ***@***.***> 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
<#66 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALEMXyrHSVgefqv_y8YKJu3tIggBj1jks5uaL4TgaJpZM4WgALo>
.
|
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
pinging @danieliser :-) |
futtta
added this to the 1.9.0 milestone
Sep 15, 2018
added a commit
that referenced
this issue
Sep 16, 2018
futtta
added
the
to be tested
label
Sep 16, 2018
This comment has been minimized.
This comment has been minimized.
danieliser
commented
Sep 16, 2018
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).
|
This comment has been minimized.
This comment has been minimized.
danieliser
commented
Sep 16, 2018
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. |
This comment has been minimized.
This comment has been minimized.
danieliser
commented
Sep 16, 2018
•
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.
|
This comment has been minimized.
This comment has been minimized.
thanks for the detailed feedback @danieliser |
This comment has been minimized.
This comment has been minimized.
danieliser
commented
Sep 21, 2018
@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. |
futtta commentedSep 8, 2018
any idea regarding https://wordpress.org/support/topic/array_merge-argument-2-is-not-an-array-6/ @denydias