From 5b18b4ad0ebc62b070faef71a93dd59abf7b1064 Mon Sep 17 00:00:00 2001
From: zymeli <710055@qq.com>
Date: Sun, 12 Nov 2023 20:03:41 +0800
Subject: [PATCH 2/7] If an internal PHP function, such as `call_user_func`, in
the backtrace, the 'file' and 'line' not be available.
such as `call_user_func`:
...
D:\yii2\common\yiime\DbActiveQuery.php:34
D:\yii2\backend\controllers\SiteController.php:83
[ 'function' => 'actionLogin' 'class' => 'backend\\controllers\\SiteController' 'type' => '->' ]
D:\yii2\vendor\yiisoft\yii2\base\InlineAction.php:57
D:\yii2\vendor\yiisoft\yii2\base\Controller.php:178
...
such as `ReflectionClass::newInstanceArgs`:
...
D:\yii2\vendor\yiisoft\yii2-debug\src\panels\UserPanel.php:83
D:\yii2\vendor\yiisoft\yii2\base\BaseObject.php:109
[ 'function' => '__construct' 'class' => 'yii\\base\\BaseObject' 'type' => '->' ]
D:\yii2\vendor\yiisoft\yii2\di\Container.php:419
D:\yii2\vendor\yiisoft\yii2\di\Container.php:170
...
---
src/views/default/panels/log/detail.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/views/default/panels/log/detail.php b/src/views/default/panels/log/detail.php
index 70273bca2..6b0947c2a 100644
--- a/src/views/default/panels/log/detail.php
+++ b/src/views/default/panels/log/detail.php
@@ -136,7 +136,11 @@
$message .= Html::ul($data['trace'], [
'class' => 'trace',
'item' => static function ($trace) use ($panel) {
- return '
' . $panel->getTraceLine($trace) . '';
+ if (isset($trace['file'])) {
+ return '
' . $panel->getTraceLine($trace) . '';
+ } else {
+ return '
' . Html::encode(\yii\helpers\VarDumper::dumpAsString($trace)) . '';
+ }
}
]);
}
From 9981ab8e893888ce435836725b114d77800e6b45 Mon Sep 17 00:00:00 2001
From: zymeli <710055@qq.com>
Date: Thu, 23 Nov 2023 23:43:44 +0800
Subject: [PATCH 3/7] Restore Changes
---
src/views/default/panels/log/detail.php | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/views/default/panels/log/detail.php b/src/views/default/panels/log/detail.php
index 6b0947c2a..70273bca2 100644
--- a/src/views/default/panels/log/detail.php
+++ b/src/views/default/panels/log/detail.php
@@ -136,11 +136,7 @@
$message .= Html::ul($data['trace'], [
'class' => 'trace',
'item' => static function ($trace) use ($panel) {
- if (isset($trace['file'])) {
- return '
' . $panel->getTraceLine($trace) . '';
- } else {
- return '
' . Html::encode(\yii\helpers\VarDumper::dumpAsString($trace)) . '';
- }
+ return '
' . $panel->getTraceLine($trace) . '';
}
]);
}
From 8437d33bdc713d41208bdda9bd12ff6b43dd30f5 Mon Sep 17 00:00:00 2001
From: zymeli <710055@qq.com>
Date: Thu, 23 Nov 2023 23:47:13 +0800
Subject: [PATCH 4/7] If an internal PHP function, such as `call_user_func`, in
the backtrace, the 'file' and 'line' not be available.
@see https://www.php.net/manual/en/function.debug-backtrace.php#59713
---
src/Panel.php | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/Panel.php b/src/Panel.php
index a38abcb4e..d2857781c 100644
--- a/src/Panel.php
+++ b/src/Panel.php
@@ -131,6 +131,14 @@ public function getUrl($additionalParams = null)
*/
public function getTraceLine($options)
{
+ /**
+ * If an internal PHP function, such as `call_user_func`, in the backtrace, the 'file' and 'line' not be available.
+ * @see https://www.php.net/manual/en/function.debug-backtrace.php#59713
+ */
+ if (!isset($options['file'])) {
+ return VarDumper::dumpAsString($options);
+ }
+
if (!isset($options['text'])) {
$options['text'] = "{$options['file']}:{$options['line']}";
}
From 5f6b499fd898bd875d369fd1cc0ce229d3a301b8 Mon Sep 17 00:00:00 2001
From: zymeli <710055@qq.com>
Date: Thu, 23 Nov 2023 23:53:16 +0800
Subject: [PATCH 5/7] Update CHANGELOG.md
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index be3b8c253..4c3902d85 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Yii Framework 2 debug extension Change Log
2.1.26 under development
------------------------
-- no changes in this release.
+- Fix the backtrace, the 'file' and 'line' not be available (zymeli)
2.1.25 September 26, 2023
From 032c11c376894c432a7b2014b3899c5605c216be Mon Sep 17 00:00:00 2001
From: zymeli <710055@qq.com>
Date: Fri, 24 Nov 2023 00:30:46 +0800
Subject: [PATCH 6/7] Update CHANGELOG.md
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c3902d85..ffdca06c5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Yii Framework 2 debug extension Change Log
2.1.26 under development
------------------------
-- Fix the backtrace, the 'file' and 'line' not be available (zymeli)
+- Bug #528: Fix the backtrace, the 'file' and 'line' not be available (zymeli)
2.1.25 September 26, 2023
From 032e4492ca738f43b2b534dca549b7c86e26c20c Mon Sep 17 00:00:00 2001
From: zymeli <710055@qq.com>
Date: Fri, 24 Nov 2023 21:55:46 +0800
Subject: [PATCH 7/7] Update CHANGELOG.md
Co-authored-by: Bizley
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ffdca06c5..fce95457a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Yii Framework 2 debug extension Change Log
2.1.26 under development
------------------------
-- Bug #528: Fix the backtrace, the 'file' and 'line' not be available (zymeli)
+- Bug #528: Fix `yii\debug\Panel::getTraceLine()` to handle backtrace for internal PHP functions (zymeli)
2.1.25 September 26, 2023