Welcome Guest, Not a member yet? Register   Sign In
"Array to string conversion" when ,,mixed'' array in $autoload['libraries']
#1

CI 3.0.1, PHP 5.5.12, Windows

This is a part of my autoload.php:
PHP Code:
$autoload['libraries'] = array(
 'database',
 array('MY_Smarty' => 'smarty')
); 


When a page is loaded I get (3 times):

Quote:A PHP Error was encountered

Severity: Notice
Message: Array to string conversion
Filename: core/Loader.php
Line Number: 1320
Backtrace:
File: (...)\index.php
Line: 292
Function: require_once



I managed to ,,fix'' the error by simply adding @ before array_diff(...) in Loader.php:1320.

I know, that the issue is more a problem with PHP itself rather than CodeIgniter.
Furthermore, analogous code does not give any notices on _Linux_ on PHP 5.3.29.
However, I believe Windows users should not encounter the problem in future releases of CI.

I added an issue on GitHub: https://github.com/bcit-ci/CodeIgniter/issues/4083
Reply
#2

Shouldn't this be:
PHP Code:
$autoload['libraries'] = array(
    
'database',
    
'MY_Smarty' => 'smarty',
); 
Reply
#3

Ooh!! Of course it should. I don't know how I missed it... And why did I use the array?!
It was very late at night, I thinkWink
Thank you.

Thread closed.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB