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

A controller parameter without default value creates ReflectionException error #1948

Closed
krishnan57474 opened this issue Apr 16, 2019 · 0 comments

Comments

@krishnan57474
Copy link

Describe the bug
A controller parameter without default value creates error in routes collector toolbar.

CodeIgniter 4 version
CodeIgniter4 Beta 0.0.2

Affected module(s)
system\Debug\Toolbar\Collectors\Routes.php

Expected behavior, and steps to reproduce if appropriate

  1. Set CodeIgniter environment to development
  2. Create parameter ( public function index(...$params) ) in index method
  3. run

You get

ReflectionException Internal error: Failed to retrieve the default value

The following statement in system\Debug\Toolbar\Collectors\Routes.php:

    '<empty>&nbsp| default: ' . var_export($param->getDefaultValue(), true),

Calling $param->getDefaultValue() without isDefaultValueAvailable check causes this exists error.

Fix

    '<empty>&nbsp| default: ' . var_export($param->isDefaultValueAvailable() ? $param->getDefaultValue() : null, true),
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