katzgrau / getsparks.org

getsparks.org - The CodeIgniter Package Managment Repository
http://getsparks.org
MIT License
82 stars 17 forks source link

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

Open mikedfunk opened 12 years ago

mikedfunk commented 12 years ago

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.