[php-src] PR #12422: Close PHP tags in tests
| From: | iluuu1994 | Date: | Wed, 11 Oct 2023 21:19:19 +0000 |
| Subject: | [php-src] PR #12422: Close PHP tags in tests | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23871@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12422
Author: iluuu1994
Some of these may be intended, I'll check and revert them manually.
Script I used to fix these:
```php
$it = new RecursiveDirectoryIterator(__DIR__);
foreach(new RecursiveIteratorIterator($it) as $file) {
$path = $file->getPathname();
if ($file->getExtension() !== 'phpt' || strpos($path, '.git') !== false)
{
continue;
}
$content = file_get_contents($file->getPathname());
$sections = preg_split('((?=^--\w+--$))m', $content);
$changed = false;
foreach ($sections as $i => $section) {
if (preg_match("(^(--\w+--)\n<\?php)", $section) === 1 &&
strpos($section, '?>') === false) {
$sections[$i] .= "?>\n";
$changed = true;
}
}
if ($changed) {
file_put_contents($path, implode("", $sections));
}
}
```