Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception output of missing function in controller is wrong #27344

Closed
SamuelNitsche opened this issue Jan 29, 2019 · 6 comments
Closed

Exception output of missing function in controller is wrong #27344

SamuelNitsche opened this issue Jan 29, 2019 · 6 comments

Comments

@SamuelNitsche
Copy link
Contributor

  • Laravel Version: 5.7.22
  • PHP Version: 7.2.4
  • Database Driver & Version: -

Description:

When you add a route to a controller function that does not exist, laravel throws a ReflectionException instead of a BadMethodCallException. The exception says that the function () does not exist.

bildschirmfoto 2019-01-29 um 11 23 19

Steps To Reproduce:

  1. Edit your web.php file like this (does not happen when you pass the controller and function as string)
Route::get('/test', [TestController::class, 'index']);
  1. Create the TestController but don't create function index
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class TestController extends Controller
{
    //
}
  1. Visit the new route

Expected behaviour would be that laravel tells which function does not exist.

@driesvints
Copy link
Member

Hmm, I can see why this is a problem indeed although I wouldn't necessarily label this as a bug but rather an enhancement. Welcoming PRs which might improve this error message.

@akiyamaSM
Copy link
Contributor

Is it even the good syntax? I mean even if you put a name of existing method it wouldn't work.

@SamuelNitsche
Copy link
Contributor Author

SamuelNitsche commented Jan 30, 2019 via email

@driesvints
Copy link
Member

Yeah it was added here: #24385

@akiyamaSM
Copy link
Contributor

may be something related to the version of PHP 7.1.20

@driesvints
Copy link
Member

A PR was merged that should address this: #28397

Thanks @570studio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants