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

If the controller’s method's parameter has a default value , the program will show 500 error #461

Closed
jk1860 opened this issue Apr 6, 2017 · 5 comments

Comments

@jk1860
Copy link

jk1860 commented Apr 6, 2017

`<?php namespace App\Controllers;

use CodeIgniter\Controller;

class Home extends Controller
{
public function index($page = 'welcome_message')
{
return view($page);
}

//--------------------------------------------------------------------

}
`
just modify the Application/Controllers/Home.php's code to this, the program will not work。

@lonnieezell
Copy link
Member

I have not ran into any instances of this happening. You don't provide the exact error message you were getting, but it sounds pretty close to one that you'd get if you were not running on PHP 7.

Can you verify the version of PHP you're using and provide the error message, please?

@jk1860
Copy link
Author

jk1860 commented Apr 7, 2017

my php version is 7.1.3 , and the error message is : 500 (Internal Server Error)

@lonnieezell
Copy link
Member

Weird. That's something completely different than I get. Can you check your PHP error logs to see what the underlying error actually is? On mine, I get an Exception thrown, but that's due to an issue in the debug toolbar. Maybe try turning that off and seeing if that's the issue?

@jk1860
Copy link
Author

jk1860 commented Apr 7, 2017

In the file CodeIgniter , the function handleRequest, the code
`$response = $filters->run($uri, 'after');

	if ($response instanceof Response)
	{
		$this->response = $response;
	}`

If I delete these code ,the program is fine .

@jk1860
Copy link
Author

jk1860 commented Apr 7, 2017

yes, it is the debug Toolbar's problem!

@jk1860 jk1860 closed this as completed Apr 7, 2017
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

2 participants