php - Laravel - call_user_func_array() expects parameter 1 to be a valid callback -


i'm getting error:

call_user_func_array() expects parameter 1 valid callback, class 'symfony\component\httpfoundation\laravelrequest' not have method 'url' 

the code i'm using is:

routes.php:

<?php  route::post('', 'app@check'); route::get('', 'app@check'); route::post('game', 'app@game'); route::get('game', 'app@game'); route::get('terminos', 'app@terminos'); route::post('save', 'scores@savescore'); route::get('scores', 'scores@scorelist'); route::get('scores2468', 'scores@showscores');    event::listen('404', function() {     //return response::error('404');     echo "error 404: \n";     echo request::url(); });  event::listen('500', function() {     return response::error('500'); });    route::filter('before', function() {     // stuff before every request application... });  route::filter('after', function($response) {     // stuff after every request application... });  route::filter('csrf', function() {     if (request::forged()) return response::error('500'); });  route::filter('auth', function() {     if (auth::guest()) return redirect::to('login'); }); 

scores.php:

class scores_controller extends base_controller {      public $restful = true;          public function get_showscores()     {         // imprimo pantalla con tabla de resultados         $regs = array('regs' => score::order_by('score','desc')->get());         //dd($regs);         return view::make('score.show', $regs);     }          public function post_savescore()     {         // tomo facebooksdk instance         $facebook = ioc::resolve('facebook-sdk');         $accesstoken = $facebook->getaccesstoken();         $user = $facebook->getuser();         $user_profile = $facebook->api('/me');          if ($user) {             // logueado             $data = input::all();             // guardo un nuevo score             $score = score::create(array(                 'nombre' => $user_profile['name'],                 'score' => $data['score'],                 'fbid' => $user_profile['id']                 ));              return json_encode($score->attributes);         }else{             // no hay sesion             return false;         }      }          public function get_scorelist(){          $facebook = ioc::resolve('facebook-sdk');          $scores = score::order_by('score','desc')->take(10)->get();          $response = array();         foreach($scores $sc){             $ua = $facebook->api('http://www.facebook.com/'.$sc->attributes['fbid']);             $dat = array(                 //'name' => $user->name,                 'nombre' => $sc->attributes['nombre'],                 'uid' => $sc->attributes['fbid'],                 'score' => $sc->attributes['score']                 );             array_push($response, $dat);         }          return json_encode($response);     } } 

this part of facebook app, might have noticed. thing when try call 'save' route, error posted before.

the full error description incl. backtrace:

unhandled exception

message:

call_user_func_array() expects parameter 1 valid callback, class 'symfony\component\httpfoundation\laravelrequest' not have method 'url' 

location:

/www/conamor/htdocs/apps/aventuracenter/pacman/laravel/request.php on line 287 

stack trace:

#0 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/laravel.php(42): laravel\error::native(2, 'call_user_func_...', '/www/conamor/ht...', 287) #1 [internal function]: laravel\{closure}(2, 'call_user_func_...', '/www/conamor/ht...', 287, array) #2 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/request.php(287): call_user_func_array(array, array) #3 /www/conamor/htdocs/apps/aventuracenter/pacman/application/routes.php(63): laravel\request::__callstatic('url', array) #4 /www/conamor/htdocs/apps/aventuracenter/pacman/application/routes.php(63): laravel\request::url() #5 [internal function]: {closure}() #6 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/event.php(199): call_user_func_array(object(closure), array) #7 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/event.php(124): laravel\event::fire('404', array) #8 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/laravel.php(109): laravel\event::first('404') #9 [internal function]: laravel\{closure}('save') #10 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/routing/route.php(163): call_user_func_array(object(closure), array) #11 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/routing/route.php(124): laravel\routing\route->response() #12 /www/conamor/htdocs/apps/aventuracenter/pacman/laravel/laravel.php(167): laravel\routing\route->call() #13 /www/conamor/htdocs/apps/aventuracenter/pacman/public/index.php(34): require('/www/conamor/ht...') #14 {main} 

any ideas? in advance!

according stack trace, laravel fires 404 event. means, event handler throws error. furthermore call_user_func' complaining missing functionurl()` in handler. seems me call

echo request::url(); 

is root of evil here. remove , check see if still error.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -