Skip to content

Commit

Permalink
Add check for recursiveness when creating the clipboard payload.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed Sep 6, 2023
1 parent b8dd411 commit 30517db
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Payloads/LogPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Exception;
use Spatie\Ray\ArgumentConverter;
use Symfony\Component\VarExporter\VarExporter;

class LogPayload extends Payload
{
Expand Down Expand Up @@ -60,10 +61,21 @@ protected function getClipboardData($value): string
return (string) $value;
}

if ($this->isRecursive($value)) {
return '';
}

try {
return var_export($value, true);
} catch (Exception $ex) {
return '';
}
}

function isRecursive($value): bool
{
$dump = print_r($value, true);

return (strpos($dump, '*RECURSION*') !== false);
}
}

0 comments on commit 30517db

Please sign in to comment.