Closed (outdated)
Project:
Drupal core
Version:
8.9.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Nov 2012 at 14:28 UTC
Updated:
27 Apr 2021 at 03:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berdirRelated: #1739808: Notice: Undefined index: file in Drupal\Core\Database\Log->findCaller() showed that sometimes file/line is also not present. this is however not used here.
$call['args'] is already initialized to an empty array a few lines above. So this can be removed.
This can be removed. Tagging as novice for that.
Comment #2
ifux commentedif that's all you need!?! yeah I can remove a line :-) ;-)
greets ifux
Comment #3
berdirYes that's all :)
@das-peter, were you able to identify a way to produce this notice so that we could add test coverage for it?
Comment #4
das-peter commented@ifux Thanks!
@Berdir Unfortunately not.
I can only guess that this could happen if the an error happens in a function without parameters or in code that's not part of a function.
Comment #6
das-peter commented#2: core-more-defensive-error-handler-2.patch queued for re-testing.
Comment #7
Anonymous (not verified) commented$call['args'] needs to be defined so the implode statement doesn't give an error.
Comment #8
berdirIt's not visible in the patch, but it is, see http://api.drupal.org/api/drupal/core%21includes%21errors.inc/function/f....
I guess one way to test this function would be to write a unit test that manually builds up some backtrace-like arrays and passes it to that function.
Comment #9
Anonymous (not verified) commentedI was blind when I check the git source. Sorry for the noise.
Comment #10
das-peter commentedI think I figured out a way how to reproduce this case.
I've overwritten a class method which had a typed parameter. But I forgot to add the
usepart - thus the type of the parameter was "unknown" and the class autoloader failed.However, I'm not sure this is the easiest way to reproduce it ;)
Comment #11
ifux commentedberdir told me to implement the following test
Comment #12
ifux commentedand the test only patch to show that it's not working without patch from above
Comment #14
berdirtest-only failed as we expected it to.
Comment #15
das-peter commentedI think these lines could be removed, right?
Everything else looks really good to me - thanks!
Comment #16
ifux commentedremoved them.
1. just the test patch -> should fail
2. complete patch -> should pass
Comment #17
ifux commentedComment #18
ifux commentedhopefully last try!
some unnecessary lines removed
Comment #20
ifux commented#18: core-more-defensive-error-handler-test.patch queued for re-testing.
Comment #22
ifux commented#18: core-more-defensive-error-handler-test.patch queued for re-testing.
Comment #24
das-peter commented#18: core-more-defensive-error-handler-test.patch queued for re-testing.
Comment #26
das-peter commented#18: core-more-defensive-error-handler-test.patch queued for re-testing.
Comment #28
das-peter commented#18: core-more-defensive-error-handler-test.patch queued for re-testing.
Comment #29
das-peter commented@ifux I'm absolutely happy with that.
I say RTBC.
Comment #30
catchOK the patch looks great, but we could do with a comment explaining why args is sometimes empty I think.
Comment #31
berdircomment #10 is about the only idea that we have so far. Officially, this shouldn't happen, as far as I know.
Comment #32
das-peter commentedI don't have an idea either. As berdir pointed out I experienced the error only in the in #10 described case.
Does this missing comment really block this patch? It's quite annoying to have this error instead the real one when running tests on new stuff ;)
Comment #33
yesct commentedI added the comment based on the info in #10
I also fixes some small standards stuff
from: http://drupal.org/node/1354#file
and whitespace/new lines at the start and end of class (edit: http://drupal.org/node/1353118 namespaces standards doc has an example that shows them)
Comment #34
mitron commentedWhy are there more passing tests on the "FAILED" test (49,316) than on the "PASSED" test (49,231)? Something else, other than the patch, seems to have changed between the two test runs. Is it reasonable to re-test?
Comment #35
yesct commented#33: drupal-more_defensive_error_handler-1832300-33-tests-only.patch queued for re-testing.
Comment #36
berdirThe number of assertions is always slightly different, because for example the number of batch steps for the upgrade tests differ depending on how fast the testbot is.
Comment #37
Anonymous (not verified) commentedI have reviewed and applied both patches. The first version (drupal-more_defensive_error_handler-1832300-33-tests-only.patch) fails as expected, the second version (drupal-more_defensive_error_handler-1832300-33.patch) runs successful.
It's working fine for me. The patch contains a test case and the changed logic i documented.
Comment #38
das-peter commented#33: drupal-more_defensive_error_handler-1832300-33.patch queued for re-testing.
Comment #39
xanohttp://nl1.php.net/manual/en/function.debug-backtrace.php describes the array keys as follows:
This means that the official PHP documentation admits these keys, including
args, are optional. As it does not provide any reasons, though, I suggest we simply point developers there rather than giving one possible explanation of why the array key might not exist.Comment #40
xanoOh well.
Comment #41
socketwench commentedNovice issue cleanup. (https://drupal.org/core-mentoring/novice-tasks) Also attempted to reroll the patch, it appears that most of changes are no longer relevant to code. Setting the issue to postponed as a result.
Comment #42
mgiffordI'm unclear what this is waiting for? Can we close the issue or does it need to be completely re-written?
Comment #51
quietone commented#41 is correct this is no longer relevant, format_backtrace was removed in Drupal 8.0.x in #2300891: Remove format_backtrace() from error.inc as deprecated.