• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XenForo_Application::get('config') returns Zend Object instead of Array

Marcus

Well-known member
#1
I would like to return the exact array or value from /library/config.php

in config.php
PHP:
$config['test'] = [
  'value1' => 'one',
  'value2'  => 'two',
];
PHP:
$configphp = XenForo_Application::get('config')->test;
print_r($configphp);
returns
PHP:
Zend_Config Object ( [_allowModifications:protected] => [_index:protected] => 0 [_count:protected] => 2 [_data:protected] => Array ( [value1] => one [value2] => two ) [_skipNextIteration:protected] => [_loadedSection:protected] => [_extends:protected] => Array ( ) [_loadFileErrorStr:protected] => ) \n
When I try to convert it to (array) ...
PHP:
$configphp = (array)XenForo_Application::get('config')->test;
print_r($configphp);
returns
PHP:
Array ( [*_allowModifications] => [*_index] => 0 [*_count] => 3 [*_data] => Array ( [value1] => one [value2] => two ) [*_skipNextIteration] => [*_loadedSection] => [*_extends] => Array ( ) [*_loadFileErrorStr] => ) \n