8
8
* License: GNU/GPLv2
9
9
* @see LICENSE.txt
10
10
*
11
- * This file: The scanner (last modified: 2023.09.25 ).
11
+ * This file: The scanner (last modified: 2023.12.01 ).
12
12
*/
13
13
14
14
namespace phpMussel \Core ;
@@ -380,7 +380,7 @@ public function directoryRecursiveList(string $Base, bool $Directories = false):
380
380
$ Offset = strlen ($ Base );
381
381
$ List = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ Base ), \RecursiveIteratorIterator::SELF_FIRST );
382
382
foreach ($ List as $ Item => $ List ) {
383
- if (preg_match ('~^(?:/\.\.|./\.|\.{3})$~ ' , str_replace ("\\" , '/ ' , substr ($ Item , -3 ))) || !is_readable ($ Item )) {
383
+ if (preg_match ('~^(?:/\.\.|./\.|\.{3})$~ ' , str_replace ('\\' , '/ ' , substr ($ Item , -3 ))) || !is_readable ($ Item )) {
384
384
continue ;
385
385
}
386
386
if (is_dir ($ Item ) && !$ Directories ) {
@@ -783,7 +783,7 @@ private function recursor($Files = '', int $Depth = -1): void
783
783
if (is_dir ($ Files )) {
784
784
if (!is_readable ($ Files )) {
785
785
$ this ->Loader ->InstanceCache ['ScanErrors ' ]++;
786
- $ this ->atHit ('' , -1 , preg_replace (['~[\x00-\x1F]~ ' , '~^[ \\\/]~ ' ], '' , $ Files ), sprintf (
786
+ $ this ->atHit ('' , -1 , preg_replace (['~[\x00-\x1F]~ ' , '~^[ \\\\ /]~ ' ], '' , $ Files ), sprintf (
787
787
$ this ->Loader ->L10N ->getString ('grammar_exclamation_mark ' ),
788
788
sprintf ($ this ->Loader ->L10N ->getString ('response.Failed to access %s ' ), $ OriginalFilename )
789
789
), -5 , $ Depth );
@@ -810,7 +810,7 @@ private function recursor($Files = '', int $Depth = -1): void
810
810
$ this ->resetHeuristics ();
811
811
812
812
/** Ensure that the original filename doesn't break lines and clean it up. */
813
- $ OriginalFilenameClean = preg_replace (['~[\x00-\x1F]~ ' , '~^[ \\\/]~ ' ], '' , $ OriginalFilename );
813
+ $ OriginalFilenameClean = preg_replace (['~[\x00-\x1F]~ ' , '~^[ \\\\ /]~ ' ], '' , $ OriginalFilename );
814
814
815
815
/** Indenting to apply for "checking" . */
816
816
$ Indent = str_pad ('→ ' , ($ Depth < 1 ? 4 : ($ Depth * 3 ) + 4 ), '─ ' , STR_PAD_LEFT );
@@ -1728,7 +1728,7 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
1728
1728
) {
1729
1729
$ this ->Loader ->InstanceCache ['LookupCount ' ] = 0 ;
1730
1730
$ URLScanner = [
1731
- 'FixedSource ' => preg_replace ('~(data|f(ile|tps?)|https?|sftp):~i ' , "\x01\\1: " , str_replace ("\\" , '/ ' , $ str_norm )) . "\1" ,
1731
+ 'FixedSource ' => preg_replace ('~(data|f(ile|tps?)|https?|sftp):~i ' , "\x01\\1: " , str_replace ('\\' , '/ ' , $ str_norm )) . "\1" ,
1732
1732
'DomainsNoLookup ' => [],
1733
1733
'DomainsCount ' => 0 ,
1734
1734
'Domains ' => [],
@@ -3003,8 +3003,8 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
3003
3003
3004
3004
/** Fetch and prepare filename. */
3005
3005
if ($ Filename = $ ArchiveObject ->EntryName ()) {
3006
- while (strpos ($ Filename , "\\" ) !== false || strpos ($ Filename , '/ ' ) !== false ) {
3007
- $ Filename = $ this ->Loader ->substrAfterLast ($ Filename , "\\" );
3006
+ while (strpos ($ Filename , '\\' ) !== false || strpos ($ Filename , '/ ' ) !== false ) {
3007
+ $ Filename = $ this ->Loader ->substrAfterLast ($ Filename , '\\' );
3008
3008
$ Filename = $ this ->Loader ->substrAfterLast ($ Filename , '/ ' );
3009
3009
}
3010
3010
}
@@ -3017,7 +3017,7 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
3017
3017
$ Hash = hash ('sha256 ' , $ Content );
3018
3018
$ DataCRC32 = hash ('crc32b ' , $ Content );
3019
3019
$ InternalCRC = $ ArchiveObject ->EntryCRC ();
3020
- $ ThisItemRef = $ ItemRef . '→ ' . preg_replace (['~[\x00-\x1F]~ ' , '~^[ \\\/]~ ' ], '' , $ Filename );
3020
+ $ ThisItemRef = $ ItemRef . '→ ' . preg_replace (['~[\x00-\x1F]~ ' , '~^[ \\\\ /]~ ' ], '' , $ Filename );
3021
3021
3022
3022
/** Verify filesize, integrity, etc. Exit early in case of problems. */
3023
3023
if ($ Filesize !== strlen ($ Content ) || (
@@ -3264,7 +3264,7 @@ private function memoryUse(string $Path, int $Delete = 0, int $DeleteFiles = 0):
3264
3264
$ Files = [];
3265
3265
$ List = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ Path ), \RecursiveIteratorIterator::SELF_FIRST );
3266
3266
foreach ($ List as $ Item => $ List ) {
3267
- $ File = str_replace ("\\" , '/ ' , substr ($ Item , $ Offset ));
3267
+ $ File = str_replace ('\\' , '/ ' , substr ($ Item , $ Offset ));
3268
3268
if ($ File && strtolower (substr ($ Item , -4 )) === '.qfu ' && is_file ($ Item ) && !is_link ($ Item ) && is_readable ($ Item )) {
3269
3269
$ Files [$ File ] = filemtime ($ Item );
3270
3270
}
@@ -3308,7 +3308,7 @@ private function normalise(string $str, bool $html = false, bool $decode = false
3308
3308
while (true ) {
3309
3309
if (
3310
3310
function_exists ('gzinflate ' ) &&
3311
- $ c = preg_match_all ('/(gzinflate\s*\(\s*[" \'])(.{1,4096})(,\d)?([" \']\s*\))/i ' , $ str , $ matches )
3311
+ $ c = preg_match_all ('/(gzinflate\s* \\ (\s*[" \'])(.{1,4096})(,\d)?([" \']\s* \ \))/i ' , $ str , $ matches )
3312
3312
) {
3313
3313
for ($ i = 0 ; $ c > $ i ; $ i ++) {
3314
3314
$ str = str_ireplace (
@@ -3321,8 +3321,8 @@ function_exists('gzinflate') &&
3321
3321
}
3322
3322
if ($ c = preg_match_all (
3323
3323
'/(base64_decode|decode_base64|base64\.b64decode|atob|Base64\.decode64)(\s* ' .
3324
- '\(\s*[" \'\`])([\da-z+\/]{4})*([\da-z+\/]{4}|[\da-z+\/]{3}=|[\da-z+\/]{2}==)([" \'\`] ' .
3325
- '\s*\))/i ' ,
3324
+ '\\ (\s*[" \'\`])([\da-z+\/]{4})*([\da-z+\/]{4}|[\da-z+\/]{3}=|[\da-z+\/]{2}==)([" \'\`] ' .
3325
+ '\s* \\ ))/i ' ,
3326
3326
$ str ,
3327
3327
$ matches
3328
3328
)) {
@@ -3336,7 +3336,7 @@ function_exists('gzinflate') &&
3336
3336
continue ;
3337
3337
}
3338
3338
if ($ c = preg_match_all (
3339
- '/(str_rot13\s*\(\s*[" \'])([^ \'"\(\ )]{1,4096})([" \']\s*\))/i ' ,
3339
+ '/(str_rot13\s* \\ (\s*[" \'])([^ \'" \\ ( \\ )]{1,4096})([" \']\s* \ \))/i ' ,
3340
3340
$ str ,
3341
3341
$ matches
3342
3342
)) {
@@ -3350,7 +3350,7 @@ function_exists('gzinflate') &&
3350
3350
continue ;
3351
3351
}
3352
3352
if ($ c = preg_match_all (
3353
- '/(hex2bin\s*\(\s*[" \'])([\da-f]{1,4096})([" \']\s*\))/i ' ,
3353
+ '/(hex2bin\s* \\ (\s*[" \'])([\da-f]{1,4096})([" \']\s* \ \))/i ' ,
3354
3354
$ str ,
3355
3355
$ matches
3356
3356
)) {
@@ -3364,7 +3364,7 @@ function_exists('gzinflate') &&
3364
3364
continue ;
3365
3365
}
3366
3366
if ($ c = preg_match_all (
3367
- '/([Uu][Nn][Pp][Aa][Cc][Kk]\s*\(\s*[" \']\s*H\*\s*[" \']\s*,\s*[" \'])([\da-fA-F]{1,4096})([" \']\s*\))/ ' ,
3367
+ '/([Uu][Nn][Pp][Aa][Cc][Kk]\s* \\ (\s*[" \']\s*H\*\s*[" \']\s*,\s*[" \'])([\da-fA-F]{1,4096})([" \']\s* \ \))/ ' ,
3368
3368
$ str ,
3369
3369
$ matches
3370
3370
)) {
@@ -3833,7 +3833,7 @@ private function matchVarInSigFile($Actual, $Expected): bool
3833
3833
*/
3834
3834
private function splitSigParts (string $ Sig , int $ Max = -1 ): array
3835
3835
{
3836
- return preg_split ('~(?<!\?|\<)\ :~ ' , $ Sig , $ Max , PREG_SPLIT_NO_EMPTY );
3836
+ return preg_split ('~(?<!\?|\<):~ ' , $ Sig , $ Max , PREG_SPLIT_NO_EMPTY );
3837
3837
}
3838
3838
3839
3839
/**
0 commit comments