Closed (fixed)
Project:
Drupal core
Version:
9.2.x-dev
Component:
database system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Sep 2018 at 00:50 UTC
Updated:
9 Feb 2021 at 14:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
volegerI guess we need just remove the related function. Because of script will check the namespace of the caller class:
((isset($caller['class']) && (strpos($caller['class'], 'Query') !== FALSE || strpos($caller['class'], 'Database') !== FALSE || strpos($caller['class'], 'PDO') !== FALSE)) || in_array($caller['function'], $db_functions)))So, the instance of the caller of both methods after functions replacements will be in the Drupal\Core\Database\ namespace.
Comment #3
mondrakeUhm... it looks like there's some overlap between how
Drupal\Core\Utility\Erroris determining the caller, and a similar functionality inDrupal\Core\Database\Log::findCaller. Wondering is there's a chance to unify that.Comment #4
mondrakeWorking on #3.
Comment #5
andypostResult array for
debug_backtrace()&$e->getTrace()are the same so makes sense to unifyComment #6
mondrakeThis would be the idea, taking big portions from #2867788: Log::findCaller fails to report the correct caller function with non-core drivers.. If we agree this is the right direction, I can also take more testing from there.
Comment #8
mondrakeComment #9
mondrakeThis should fix one of the fails.
Comment #10
mondrakeActually both :). Ready for review.
Comment #11
volegerI guess there should be a mention to remove this check of deprecated functions in Drupal 9.
Comment #12
mondrakelike this? ;)
just a few lines above...
Comment #13
volegerYeah) Like this. Sorry)
+1 for RTBC
Comment #14
dawehnerMay I ask whether its we need a method for this and not just get the namespace out of
$connection_infoitself.Looking through all
Drupal\Core\Databasecode there is no reference to anything outside of its own namespace. I am wondering whether that's a sign that we should move this error helper methods into a component instead.Could this be some sort of generic function instead which allows you to pass along a callable for the filtering? Like
backtrace_filteror so?Comment #15
berdir> Looking through all Drupal\Core\Database code there is no reference to anything outside of its own namespace. I am wondering whether that's a sign that we should move this error helper methods into a component instead.
Yes, the goal with DBTNG was always to keep dependencies to an absolute minimum as the idea back then was to separate this into a standalone library at some that Drupal would just use.
That never fully happened but I think we should really think before adding more dependencies to that component.
Comment #16
mondrake#14:
1. 'namespace' may not be set if you have a settings.php still on D7, hence we fall back
if that wasn't the case, then yes that method would be redundant. An idea could be to fill in 'namespace' it if missing in settings.php, at each request. But that will be unnecessary most of the time and then just more overhead.
2. I have no particular argument here. Whatever.
3. Yes, but sitting where then?
Comment #17
volegerblocker for #2875394: Replace all calls to db_query, which is deprecated
Comment #18
volegerHow about to dispatch an event here and move find caller implementation to the event subscriber?
Comment #19
volegerAny thoughts about that?
Comment #20
volegerLet's try to implement a few event subscribers.
Comment #23
volegerComment #24
voleger#2875394-62: Replace all calls to db_query, which is deprecated
Trying to decrease deps.
Comment #26
volegerAddress @todo from the latest patch #3109097: Drupal 9 does not handle db_* functions any more
Set to needs work
Comment #27
mondrakeSo, #2867788: Log::findCaller fails to report the correct caller function with non-core drivers. has now landed; the major concern here seems to be to have
Logdepend onError. Let's see if we can do the other way around. Working on it.Comment #28
mondrakeSimpler now.
Comment #29
mondrakeThis needs #3112476: Always set $info['namespace'] on database connection info, to ensure that the
namespaceis available from the connection info, though.Comment #31
mondrakeComment #33
mondrakeComment #34
daffie commentedCreated the CR and updated the IS.
Comment #35
mondrakeFixed and commented in MR
Comment #36
daffie commentedComment #37
mondrakeComment #38
daffie commentedThis is a nice little fix.
All code changes look good to me.
There is a CR for the API-addition.
For me it is RTBC.
Comment #40
catchNice clean-up!
Committed 981d78c and pushed to 9.2.x. Thanks!