Commit a6b6fa5b authored by Crell's avatar Crell

Fix logic in Logger backtrace scanning now that the code is not in the includes directory anymore.

parent b7665c69
......@@ -142,11 +142,14 @@ public function log(StatementInterface $statement, $args, $time) {
*/
public function findCaller() {
$stack = debug_backtrace();
$stack_count = count($stack);
$blacklist_fragment = 'includes' . DIRECTORY_SEPARATOR . 'Drupal' . DIRECTORY_SEPARATOR . 'Database';
for ($i = 0; $i < $stack_count; ++$i) {
if (strpos($stack[$i]['file'], $blacklist_fragment) === FALSE && strpos($stack[$i + 1]['function'], 'db_') === FALSE) {
for ($i = 0, $stack_count = count($stack); $i < $stack_count; ++$i) {
// If the call was made from a function, 'class' will be empty. It's
// just easier to give it a default value than to try and integrate
// that into the if statement below.
if (empty($stack[$i]['class'])) {
$stack[$i]['class'] = '';
}
if (strpos($stack[$i]['class'], __NAMESPACE__) === FALSE && strpos($stack[$i + 1]['function'], 'db_') === FALSE) {
return array(
'file' => $stack[$i]['file'],
'line' => $stack[$i]['line'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment