katzgrau/getsparks.org — pull request #15 by mikedfunk (2012-03-05 18:22:03+00:00)
Title: Prevent PHP Error on $this->load->spark(array('spark1', 'spark2'));

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

File: /Library/WebServer/Documents/bookymark/application/controllers/home.php
Line: 53
Function: spark

File: /Library/WebServer/Documents/bookymark/index.php
Line: 260
Function: require_once

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.