- Affected version
- 1.5.14, 2.0 DP10
When array_column doesn't exist (ie php version <5.5), XenForo_Application::arrayColumn implements fallback code, but the $row isn't checked if it is an array.
As such, this code behaves differently in php 5.4 vs php 5.5;
In php 5.4 (or older), it will throw an error;
In php 5.5 and above, it returns and empty array.
Note; this also applies to the XF2 \XF\Util\Arr::arrayColumn which is a copy & paste of the same code.
As such, this code behaves differently in php 5.4 vs php 5.5;
Code:
$arr = XenForo_Application::arrayColumn(array(1,2,3,4,5), 'id');
In php 5.4 (or older), it will throw an error;
Server Error
array_key_exists() expects parameter 2 to be array, integer given
- XenForo_Application::handlePhpError()
- array_key_exists() in XenForo/Application.php at line 1242
In php 5.5 and above, it returns and empty array.
Note; this also applies to the XF2 \XF\Util\Arr::arrayColumn which is a copy & paste of the same code.