Skip to content

Commit

Permalink
Remove NULL byte from class names, which cause problems when using ph…
Browse files Browse the repository at this point in the history
…pdbg.

Resolves nette#449
  • Loading branch information
smuuf committed Jun 12, 2024
1 parent 7fd3b98 commit b8d0e64
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,13 @@ private function sendMethodList(array $methods): void
{
Environment::$checkAssertions = false;
header('Content-Type: text/plain');

// Class name might contain NULL byte (e.g. for anonymous classes),
// which might mess up our output.
$cleanClassName = str_replace("\0", '', static::class);

echo "\n";
echo 'TestCase:' . static::class . "\n";
echo 'TestCase:' . $cleanClassName . "\n";
echo 'Method:' . implode("\nMethod:", $methods) . "\n";

$dependentFiles = [];
Expand Down

0 comments on commit b8d0e64

Please sign in to comment.