mayflowergmbh/PHP_CodeBrowser — Issue #53: Code containing special characters creates warning in codebrowser.
Author: tarjei
Created: 2011-11-02 10:49:31+00:00
State: open

I got some code like this:

```php
function testGetSummary() {
$s = "KLAR BESK:RæøåÆæøåÆØÅ\n\t";
$this->item->summary = $s;
$this->filter->filter($this->item);

$this->assertEquals($this->item->summary, "KLAR BESK:RæøåÆæøåÆØÅ\n\t");
}
```

This creates this warning:

PHP Warning: DOMDocument::loadHTML(): Invalid char in CDATA 0x13 in Entity, line: 2 in /usr/share/php/PHP_CodeBrowser/View/ViewReview.php on line 248
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpcb:0
PHP 2. CbCLIController::main() /usr/bin/phpcb:56
PHP 3. CbCLIController->run() /usr/share/php/PHP_CodeBrowser/CLIController.php:378
PHP 4. CbViewReview->generate() /usr/share/php/PHP_CodeBrowser/CLIController.php:298
PHP 5. CbViewReview->_formatSourceCode() /usr/share/php/PHP_CodeBrowser/View/ViewReview.php:127
PHP 6. CbViewReview->_highlightCode() /usr/share/php/PHP_CodeBrowser/View/ViewReview.php:151
PHP 7. CbViewReview->_highlightPhpCode() /usr/share/php/PHP_CodeBrowser/View/ViewReview.php:340
PHP 8. DOMDocument->loadHTML() /usr/share/php/PHP_CodeBrowser/View/ViewReview.php:248

Suggested patch:
On line 242 in ViewReview.php add:
$code = preg_replace('/[\x00-\x08\xB-\xC\xE-\x1F]+/', '', $code);