profiler
profiler copied to clipboard
'Call to a member function getName() on a non-object'
This partial view is fails in 4.1.19 with the error written in the title:
<table>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Current route</td>
<?php /* Check for Laravel Version */ ?>
<?php if (strpos($app::VERSION, '4.1') !== FALSE): ?>
<td><?php echo Route::current()->getName(); ?></td>
<?php elseif (strpos($app::VERSION, '4.0') !== FALSE): ?>
<td><?php echo Route::currentRouteName(); ?></td>
<?php endif; ?>
</tr>
<tr>
<td>Current controller action</td>
<?php /* Check for Laravel Version */ ?>
<?php if (strpos($app::VERSION, '4.1') !== FALSE): ?>
<td><?php echo Route::current()->getActionName(); ?></td>
<?php elseif (strpos($app::VERSION, '4.0') !== FALSE): ?>
<td><?php echo Route::currentRouteAction(); ?></td>
<?php endif; ?>
</tr>
</table>
This is my laravel.log:
[2014-02-01 20:24:32] dns_local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to a member function getName() on a non-object' in /Volumes/..../app/storage/views/1eaa4eae1b9904ef170ea7f598db4d38:10
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []
I forget to mention: I am using the latest 1.7.5 version of the profiler.
Hi @erinnovations,
just a quick update: I started looking into this, but have a hard time replicating the issue. The 4.1.19 app I played with has roughly 40 routes and they come up fine. I noticed in the Laravel docs, that Route::currentRouteName();
seems to work under 4.1.x now as well?!
I'll keep working on it!
Cheers, Seb
Hey
I'm getting this error now when I redirect inside the app before. (Laravel 4.1.21)
Edit: seems like the Route::current is not been set. (dd(Route::current()) results in NULL)