Also "wash" the name attribute of textarea and select
Some checks failed
E2E / Linux / PHP ${{ matrix.php }} (8.1) (push) Has been cancelled
E2E / Linux / PHP ${{ matrix.php }} (8.3) (push) Has been cancelled
CI / Coding Style (push) Has been cancelled
CI / Static Analysis (push) Has been cancelled
Message Rendering / Linux / PHP 8.3 (push) Has been cancelled
Unit / Linux / PHP ${{ matrix.php }} (8.1) (push) Has been cancelled
Unit / Linux / PHP ${{ matrix.php }} (8.2) (push) Has been cancelled
Unit / Linux / PHP ${{ matrix.php }} (8.3) (push) Has been cancelled
Unit / Linux / PHP ${{ matrix.php }} (8.4) (push) Has been cancelled
Unit / Windows / PHP ${{ matrix.php }} (8.1) (push) Has been cancelled
Unit / Windows / PHP ${{ matrix.php }} (8.2) (push) Has been cancelled
Unit / Windows / PHP ${{ matrix.php }} (8.3) (push) Has been cancelled
Unit / Windows / PHP ${{ matrix.php }} (8.4) (push) Has been cancelled

This commit is contained in:
Pablo Zmdl 2025-08-20 17:11:47 +02:00
parent 56fb07a478
commit fd7819d342
2 changed files with 11 additions and 2 deletions

View File

@ -326,7 +326,7 @@ class rcube_washtml
$out = $value;
}
} elseif ($this->_css_prefix !== null
&& (in_array($key, ['id', 'class', 'for']) || ($key == 'name' && in_array($node->nodeName, ['a', 'img', 'input', 'form'])))
&& (in_array($key, ['id', 'class', 'for']) || ($key == 'name' && in_array($node->nodeName, ['a', 'img', 'input', 'form', 'select', 'textarea'])))
) {
$out = preg_replace('/(\S+)/', $this->_css_prefix . '\1', $value);
} elseif ($key == 'xmlns' && !strpos($value, '://')) {

View File

@ -721,7 +721,16 @@ class WashtmlTest extends TestCase
$html = '<meta content="something" name="description"><input name="myform" type="submit" /></form>';
$washed = $washer->wash($html);
$this->assertStringContainsString('name="testmyform"', $washed);
$this->assertStringNotContainsString('name="description"', $washed);
$this->assertStringContainsString('input name="testmyform"', $washed);
$html = '<textarea name="something" />';
$washed = $washer->wash($html);
$this->assertStringContainsString('name="testsomething"', $washed);
$html = '<select name="something" />';
$washed = $washer->wash($html);
$this->assertStringContainsString('name="testsomething"', $washed);
}
/**