Skip to content

Commit a40bfab

Browse files
committed
Bug-fix (#3).
Changelog excerpt: - Wrong casing used for some variables would cause undefined variable errors to occur; Fixed.
1 parent 34ea529 commit a40bfab

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
4949
[2021.05.01; Bug-fix; Maikuolan]: Log truncation not being calculated properly; Fixed.
5050

5151
[2021.05.28; Maikuolan]: Performed some minor refactoring.
52+
53+
[2021.05.28; Bug-fix; Maikuolan]: Wrong casing used for some variables would cause undefined variable errors to occur; Fixed (#3).

src/Scanner.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -514,19 +514,19 @@ private function recursor($Files = '', int $Depth = -1): void
514514
}
515515

516516
/** Read in the file to be scanned. */
517-
$in = $this->Loader->readFileBlocks($Files, (
517+
$In = $this->Loader->readFileBlocks($Files, (
518518
$this->Loader->Configuration['files']['scannable_threshold'] > 0 &&
519519
$fS > $this->Loader->readBytes($this->Loader->Configuration['files']['scannable_threshold'])
520520
) ? $this->Loader->readBytes($this->Loader->Configuration['files']['scannable_threshold']) : $fS, true);
521521

522522
/** Generate CRC for the file to be scanned. */
523-
$fdCRC = hash('crc32b', $in);
523+
$fdCRC = hash('crc32b', $In);
524524

525525
/** Generate SHA256 for the file to be scanned. */
526-
$SHA256 = hash('sha256', $in);
526+
$SHA256 = hash('sha256', $In);
527527

528528
/** Check for non-image items. */
529-
if (!empty($in) && $this->Loader->Configuration['files']['only_allow_images'] && !$this->imageIndicators($xt, bin2hex(substr($in, 0, 16)))) {
529+
if (!empty($In) && $this->Loader->Configuration['files']['only_allow_images'] && !$this->imageIndicators($xt, bin2hex(substr($In, 0, 16)))) {
530530
$this->Loader->InstanceCache['ThisScanDone']++;
531531
$this->Loader->Events->fireEvent('countersChanged');
532532
$this->Loader->atHit($SHA256, $fS, $OriginalFilenameClean, sprintf(
@@ -547,7 +547,7 @@ private function recursor($Files = '', int $Depth = -1): void
547547
$this->Loader->InstanceCache['ObjectsScanned']++;
548548

549549
/** Send the scan target to the data handler. */
550-
$this->dataHandler($in, $Depth, $OriginalFilenameClean);
550+
$this->dataHandler($In, $Depth, $OriginalFilenameClean);
551551

552552
/**
553553
* Check whether the file is compressed. If it's compressed, attempt to
@@ -557,7 +557,7 @@ private function recursor($Files = '', int $Depth = -1): void
557557
if (!empty($this->Loader->InstanceCache['CheckWasLast'])) {
558558

559559
/** Create a new compression object. */
560-
$CompressionObject = new CompressionHandler($in);
560+
$CompressionObject = new CompressionHandler($In);
561561

562562
/** Now we'll try to decompress the file. */
563563
if (!$CompressionResults = $CompressionObject->TryEverything()) {
@@ -569,28 +569,28 @@ private function recursor($Files = '', int $Depth = -1): void
569569
* Replace originally scanned data with decompressed data in case
570570
* needed by the archive handler.
571571
*/
572-
$in = $CompressionObject->Data;
572+
$In = $CompressionObject->Data;
573573
}
574574

575575
/** Cleanup. */
576576
unset($CompressionObject);
577577
}
578578

579-
$inLen = strlen($in);
579+
$InLen = strlen($In);
580580

581581
/** Executed if any problems were detected. */
582582
if (empty($this->Loader->InstanceCache['CheckWasLast'])) {
583583

584584
/** Quarantine if necessary. */
585585
if (
586586
$this->Loader->Configuration['quarantine']['quarantine_key'] &&
587-
$inLen > 0 &&
588-
$inLen < $this->Loader->readBytes($this->Loader->Configuration['quarantine']['quarantine_max_filesize'])
587+
$InLen > 0 &&
588+
$InLen < $this->Loader->readBytes($this->Loader->Configuration['quarantine']['quarantine_max_filesize'])
589589
) {
590590
/** Note: "qfu" = "Quarantined File Upload". */
591591
$qfu = $this->Loader->Time . '-' . hash('md5', $this->Loader->Configuration['quarantine']['quarantine_key'] . $fdCRC . $this->Loader->Time);
592592
$this->quarantine(
593-
$in,
593+
$In,
594594
$this->Loader->Configuration['quarantine']['quarantine_key'],
595595
$_SERVER[$this->Loader->Configuration['core']['ipaddr']],
596596
$qfu
@@ -615,7 +615,7 @@ private function recursor($Files = '', int $Depth = -1): void
615615
*/
616616
if (
617617
$this->Loader->Configuration['files']['check_archives'] &&
618-
!empty($in) &&
618+
!empty($In) &&
619619
$this->Loader->Configuration['files']['max_recursion'] > 1
620620
) {
621621
/** Define archive phase. */
@@ -625,7 +625,7 @@ private function recursor($Files = '', int $Depth = -1): void
625625
$this->Loader->InstanceCache['tempfilesToDelete'] = [];
626626

627627
/** Begin processing archives. */
628-
$this->archiveRecursor($in, (isset($CompressionResults) && !$CompressionResults) ? '' : $Files, $Depth, $OriginalFilenameClean);
628+
$this->archiveRecursor($In, (isset($CompressionResults) && !$CompressionResults) ? '' : $Files, $Depth, $OriginalFilenameClean);
629629

630630
/** Begin deleting any temporary files that snuck through. */
631631
foreach ($this->Loader->InstanceCache['tempfilesToDelete'] as $DeleteThis) {
@@ -636,7 +636,7 @@ private function recursor($Files = '', int $Depth = -1): void
636636

637637
/** Add hash cache entry here if necessary (e.g., because of encryption). */
638638
if (
639-
($InSha256 = hash('sha256', $in)) &&
639+
($InSha256 = hash('sha256', $In)) &&
640640
($AtInstanceLookupKey = sprintf('%s:%d:%s', $InSha256, strlen($In), $OriginalFilenameClean)) &&
641641
isset($this->Loader->ScanResultsIntegers[$AtInstanceLookupKey]) &&
642642
$this->Loader->ScanResultsIntegers[$AtInstanceLookupKey] === -4 &&
@@ -657,12 +657,12 @@ private function recursor($Files = '', int $Depth = -1): void
657657
if (empty($this->Loader->InstanceCache['CheckWasLast'])) {
658658
if (
659659
$this->Loader->Configuration['quarantine']['quarantine_key'] &&
660-
strlen($in) < $this->Loader->readBytes($this->Loader->Configuration['quarantine']['quarantine_max_filesize'])
660+
strlen($In) < $this->Loader->readBytes($this->Loader->Configuration['quarantine']['quarantine_max_filesize'])
661661
) {
662662
/** Note: "qfu" = "Quarantined File Upload". */
663663
$qfu = $this->Loader->Time . '-' . hash('md5', $this->Loader->Configuration['quarantine']['quarantine_key'] . $fdCRC . $this->Loader->Time);
664664
$this->quarantine(
665-
$in,
665+
$In,
666666
$this->Loader->Configuration['quarantine']['quarantine_key'],
667667
$_SERVER[$this->Loader->Configuration['core']['ipaddr']],
668668
$qfu

0 commit comments

Comments
 (0)