Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
PHP WARNING: "Argument 2 passed to elgg_extract() must be of the type array, null given #9772
While doing my monthly error log review, I noted that a particular warning was appearing again and again i.e., PHP WARNING: "Argument 2 passed to elgg_extract() must be of the type array, null given, called in /path/to/engine/lib/comments.php on line 284 and defined" in file /path/to/engine/lib/elgglib.php (line 1256)
I saw that there is a check that if the $returnvalue parameter is not an array then it will not allow us to proceed. But what if the array was empty/null? The above PHP warning is generated if a blank or null array is passed. I know this is only a warning but I thought that it would be nice to get this fixed using the below code:
Rest its up to the core team to decide.
What version of Elgg are you using?
A similar (the same?) issue has been reported in #8333. It has been fixed in Elgg 1.11.3 (and should also no longer occur on Elgg versions newer than 1.11.3). Elgg versions older than 1.12 don't get any bugfixes anymore at the present time though.
if it was a null, then it wud have get filtered out in d current check where null is not an array.
i did a negative testing by creating a blank array and saw that it was bypassing the current check defined in the function. And that is why i came up with the solution that it should also check for null/blank array.