vlucas / bulletphp

A resource-oriented micro PHP framework
http://bulletphp.com
BSD 3-Clause "New" or "Revised" License
418 stars 50 forks source link

An improvement/bug on the run() method #52

Closed entraigas closed 10 years ago

entraigas commented 10 years ago

Hello, I'm building a web app using bulletphp, and to answer some doubts I start digging into the code... And it was a nice surprise, I really like your framework :) Anyway, digging into the code I think I found a bug... let me explain better. Inside the "App.php" file, at the very end of the run() method there are these lines:

// Trigger events based on HTTP request format and HTTP response code
$this->filter(array_filter(array($this->_request->format(), $response->status(), 'after')));

But the array_filter function expect 2 args (not 3) and the filter method expect the first argument to be a scalar (not an array). Additionally, there is no need to pass the request-format and the response-status to the ´filter´ method because it will use the (already setup) $this->_request and $this->_response objects. So, I think the code should be:

// Trigger events based on HTTP request format and HTTP response code
$this->filter('after', array($this->_request->format(), $response->status()) );
//or even 
$this->filter('after');

Please, let me know your thoughts.

Marcelo.

entraigas commented 10 years ago

Nevermind... I found that I was wrong...

vlucas commented 10 years ago

Hehe - no worries :) - I have not had time to look at it yet, so nothing was wasted!