Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Sources/Actions/Admin/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -2274,15 +2274,22 @@ protected static function parseIntegrationHook(string $hook, string $rawData): a

protected static function getDefinedFunctionsInFile(string $file): array
{
static $patterns = [
// Remove multiline comments so regex does not
// match fake functions/classes inside them.
'~//[^\h]+|/\*.*?\*/~s',

// Also must remove those pesky heredocs.
'/<<<[\'"]?(\w+)[\'"]?[\r\n]+[\s\S]*?[\r\n]+\1;/',
];

$source = file_get_contents($file);

if (!str_contains($source, 'function')) {
return [];
}

// Remove multiline comments so regex does not
// match fake functions/classes inside them.
$source = preg_replace('~//[^\h]+|/\*.*?\*/~s', '', $source);
$source = preg_replace($patterns, '', $source);
$functions = [];
$namespace = '';
$class = '';
Expand Down
Loading