profiler icon indicating copy to clipboard operation
profiler copied to clipboard

'Call to a member function getName() on a non-object'

Open erinnovations opened this issue 10 years ago • 3 comments

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} [] []

erinnovations avatar Feb 01 '14 19:02 erinnovations