Skip to content

Commit a8a3642

Browse files
committed
Avoid dynamic properties.
Changelog excerpt: - Adjusted debug array code to avoid dynamic properties.
1 parent 47ea54f commit a8a3642

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

Changelog.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
169169

170170
### v3.6.1
171171

172-
- [2025.03.23]: Applied entropy limits to some additional detections.
172+
- [2025.03.24]: Applied entropy limits to some additional detections.
173+
- [2025.03.28]: Adjusted debug array code to avoid dynamic properties.

src/Scanner.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The scanner (last modified: 2025.03.24).
11+
* This file: The scanner (last modified: 2025.03.28).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -600,11 +600,11 @@ public function implodeBits(string $Input): string
600600
*/
601601
public function setScanDebugArray(&$Arr): void
602602
{
603-
unset($this->debugArr);
603+
unset($this->Loader->InstanceCache['DebugArr']);
604604
if (!is_array($Arr)) {
605605
$Arr = [];
606606
}
607-
$this->debugArr = &$Arr;
607+
$this->Loader->InstanceCache['DebugArr'] = &$Arr;
608608
}
609609

610610
/**
@@ -615,7 +615,7 @@ public function setScanDebugArray(&$Arr): void
615615
*/
616616
public function destroyScanDebugArray(&$Arr): void
617617
{
618-
unset($this->Loader->InstanceCache['DebugArrKey'], $this->debugArr);
618+
unset($this->Loader->InstanceCache['DebugArrKey'], $this->Loader->InstanceCache['DebugArr']);
619619
$Arr = null;
620620
}
621621

@@ -1202,9 +1202,9 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
12021202
}
12031203

12041204
/** Set debug values, if this has been enabled. */
1205-
if (isset($this->debugArr)) {
1206-
$this->Loader->InstanceCache['DebugArrKey'] = count($this->debugArr);
1207-
$this->debugArr[$this->Loader->InstanceCache['DebugArrKey']] = [
1205+
if (isset($this->Loader->InstanceCache['DebugArr'])) {
1206+
$this->Loader->InstanceCache['DebugArrKey'] = count($this->Loader->InstanceCache['DebugArr']);
1207+
$this->Loader->InstanceCache['DebugArr'][$this->Loader->InstanceCache['DebugArrKey']] = [
12081208
'Filename' => $OriginalFilename,
12091209
'FromCache' => true,
12101210
'Depth' => $Depth,
@@ -1682,9 +1682,9 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
16821682
) || $is_pe || $fileswitch === 'mp4');
16831683

16841684
/** Set debug values, if this has been enabled. */
1685-
if (isset($this->debugArr)) {
1686-
$this->Loader->InstanceCache['DebugArrKey'] = count($this->debugArr);
1687-
$this->debugArr[$this->Loader->InstanceCache['DebugArrKey']] = [
1685+
if (isset($this->Loader->InstanceCache['DebugArr'])) {
1686+
$this->Loader->InstanceCache['DebugArrKey'] = count($this->Loader->InstanceCache['DebugArr']);
1687+
$this->Loader->InstanceCache['DebugArr'][$this->Loader->InstanceCache['DebugArrKey']] = [
16881688
'Filename' => $OriginalFilename,
16891689
'FromCache' => false,
16901690
'Depth' => $Depth,
@@ -1711,7 +1711,7 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
17111711
'Is_Not_PHP' => $is_not_php
17121712
];
17131713
if ($is_pe) {
1714-
$this->debugArr[$this->Loader->InstanceCache['DebugArrKey']] += [
1714+
$this->Loader->InstanceCache['DebugArr'][$this->Loader->InstanceCache['DebugArrKey']] += [
17151715
'NumOfSections' => $NumOfSections,
17161716
'PEFileDescription' => $PEFileDescription,
17171717
'PEFileVersion' => $PEFileVersion,
@@ -2745,9 +2745,9 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
27452745
}
27462746

27472747
/** Set final debug values, if this has been enabled. */
2748-
if (isset($this->debugArr, $this->Loader->InstanceCache['DebugArrKey'])) {
2749-
$this->debugArr[$this->Loader->InstanceCache['DebugArrKey']]['Results'] = $this->Loader->ScanResultsIntegers[$AtInstanceLookupKey] ?? 1;
2750-
$this->debugArr[$this->Loader->InstanceCache['DebugArrKey']]['Output'] = $this->Loader->ScanResultsText[$AtInstanceLookupKey] ?? '';
2748+
if (isset($this->Loader->InstanceCache['DebugArr'], $this->Loader->InstanceCache['DebugArrKey'])) {
2749+
$this->Loader->InstanceCache['DebugArr'][$this->Loader->InstanceCache['DebugArrKey']]['Results'] = $this->Loader->ScanResultsIntegers[$AtInstanceLookupKey] ?? 1;
2750+
$this->Loader->InstanceCache['DebugArr'][$this->Loader->InstanceCache['DebugArrKey']]['Output'] = $this->Loader->ScanResultsText[$AtInstanceLookupKey] ?? '';
27512751
}
27522752

27532753
/** Register object flagged. */

0 commit comments

Comments
 (0)