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

fix: wrong Config classname to config() in Toolbar #7735

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jul 25, 2023

Description
From 6f8f3a2

I don't know why, but this bug crashes spark serve with #7733

Steps to Reproduce

Check out #7733. Run spark serve.

CodeIgniter development server started on http://localhost:8080
Press Control-C to stop.
[Tue Jul 25 14:07:30 2023] PHP 8.1.21 Development Server (http://localhost:8080) started

Navigate to http://localhost:8080/, and I see:

Unable to connect
Firefox can’t establish a connection to the server at localhost:8080.

[Tue Jul 25 14:07:55 2023] [::1]:50620 Accepted
CodeIgniter development server started on http://localhost:8081
Press Control-C to stop.
[Tue Jul 25 14:07:55 2023] PHP 8.1.21 Development Server (http://localhost:8081) started

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 25, 2023
@@ -365,7 +365,7 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
return;
}

$toolbar = Services::toolbar(config(self::class));
Copy link
Member Author

@kenjis kenjis Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self::class is CodeIgniter\Debug\Toolbar, and the basename is Toolbar.
So Factories will load Config\Toolbar (preferApp) now.

Copy link
Member Author

@kenjis kenjis Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But with #7733, Factories will try to instantiate CodeIgniter\Debug\Toolbar,
and it causes:

ArgumentCountError
Too few arguments to function CodeIgniter\Debug\Toolbar::__construct(), 0 passed in 
/.../CodeIgniter4/system/Config/Factories.php on line 183 and exactly 1 expected

But I was not able to get the error message and error log if I did not enable step debugging with Xdebug.
Why spark serve died without log?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure; that's an odd one. Maybe some kind of autoloading loop?

@kenjis kenjis merged commit 5c51240 into codeigniter4:develop Jul 25, 2023
@kenjis kenjis deleted the fix-Toolbar-config branch July 25, 2023 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants