Last modified: 2013-10-19 11:32:07 UTC
Warning: in_array() expects parameter 2 to be array, null given in /usr/local/apache/common-local/php-1.22wmf2/includes/HTMLForm.php on line 2020
According to the documentation and the actual code, that second parameter comes from HTMLFormField::flattenOptions, which only returns arrays. When did you encounter the bug, how can I reproduce it? Thanks.
Yes, this is still happening on Wikimedia projects (seen the warning this week a few times) I encountered the bug around the time I logged the bug report No, I don't know how to reproduce the bug No, I don't have a stack trace
I think it has to do with this: http://stackoverflow.com/questions/999066/why-does-php-5-2-disallow-abstract-static-class-methods Working on it...
Well, I submitted a patch to Gerrit (https://gerrit.wikimedia.org/r/#/c/62007/) with an attempt to solve the bug. However, the build went wrong for some reason. And in any case, after I submitted the patch I realized that the issue I mentioned above (see link to StackOverflow) is not the cause, as it only applies to abstract methods, and not to methods in abstract classes. So now I have no idea what may be causing the bug.
To be a bit more informative: The parameter 2 of the in_array() on line 2020 comes from the flattenOptions method of the HTMLFormField class. Looking at the code in the method, it seems that it cannot fail to return an array. So I started looking around and I thought, that because the class is abstract, and the method is static, the issue mentioned at http://stackoverflow.com/questions/999066/ may be the cause. So I submitted a patch, but the build failed for some reason, and now I realize that the issue only applies to abstract static methods, and not to static methods in abstract classes.
Change 62007 abandoned by Bartosz Dziewoński: Replaced every HTMLFormField::flattenOptions for $this->flattenOptions Reason: Per submitter. https://gerrit.wikimedia.org/r/62007