-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 issue #517
Comments
I'm not sure what I can do to fix this. It happens because you're calling a closure with the incorrect number of parameters. When we attempt to examine it with |
well i just wondering why the exceptionHandler has the right data but does not display it ( and shows a ( for me ) unclear error description ). there are much more cases that are results in something like this - i know such errors should be found by development tools, but not all do it right. |
You're right, it would be simpler, but what's happening is that while reporting an exception from something in your script (in this case the missing parameter), it tries to use Reflection to describe the parameters in that method. Which is then throwing another exception because the ReflectionMethod itself fails when it encounters that specific situation (a Closure with a missing parameter). My current belief is that the frequency we'll hit cases when we run into this is a very very small percentage of the time, and that the ability to inspect the parameters passed into methods the rest of the time is more important. Obviously, we'll monitor this as more people get to use it and see if it becomes a bigger issue than I think it will be. If that's true, then we'll decide what to do then. If you can create a better solution and submit a pull request, I'm more than happy to look at it. |
hey, found a simple solution : #551 |
Thanks! I was going to start looking into that soon since I realized it's a bigger issue than I thought it was originally while working on the Template Engine blog post this week. |
Hey, i found a problem with the error_exception.php after calling a anonymous function with too few arguments.
the exceptionHandler has the right data ( correct type, code, message etc. ) so i guess its something in the error_exception.php
Exampe Code to reproduce ( i call this in a model ) :
public function ExceptionTest() { $exampleFunc = function( $a, $b ) { }; $exampleFunc( null ); }
Output is :
`ErrorException #1
Uncaught ReflectionException: Method App\Models\Mitarbeiter::App\Models{closure}() does not exist in C:\WorkSpace\PHPPlayground\CodeIgniter4\application\Views\errors\html\error_exception.php:91 Stack trace: #0 C:\WorkSpace\PHPPlayground\CodeIgniter4\application\Views\errors\html\error_exception.php(91): ReflectionMethod->__construct('App\Models\Mita...', 'App\Models\{clo...') #1 C:\WorkSpace\PHPPlayground\CodeIgniter4\system\Debug\Exceptions.php(151): include('C:\WorkSpace\PH...') #2 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ArgumentCountError)) #3 {main} thrown `
![error](https://cloud.githubusercontent.com/assets/2429036/26361676/f821a6fe-3fdb-11e7-8327-be3389e5f18c.jpg)
if you need more informations feel free to ask :)
The text was updated successfully, but these errors were encountered: