getsparks.org icon indicating copy to clipboard operation
getsparks.org copied to clipboard

Prevent PHP Error on $this->load->spark(array('spark1', 'spark2'));

Open mikedfunk opened this issue 12 years ago • 0 comments

When loading multiple sparks via a passed array, MY_Loader.php will throw a PHP error:

A PHP Error was encountered
Severity: Warning

Message: ltrim() expects parameter 1 to be string, array given

Filename: core/MY_Loader.php

Line Number: 101

Backtrace:

File: /Library/WebServer/Documents/bookymark/application/core/MY_Loader.php
Line: 101
Function: ltrim

// etc. etc...

In the beginning of function spark($spark), if $spark is an array, it runs spark($spark) for each array item. However it continues processing the spark load as if it's a single item after that, which makes PHP mad. A simple "else" thrown in fixes this problem.

mikedfunk avatar Mar 05 '12 18:03 mikedfunk