Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ concurrency:
cancel-in-progress: true

on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
types:
- opened
- synchronize
- reopened

jobs:
test:
Expand All @@ -26,6 +27,7 @@ jobs:
- ubuntu-latest
php-version:
- '8.4'
- '8.5'

steps:
- name: Checkout
Expand Down Expand Up @@ -55,12 +57,13 @@ jobs:
run: composer install --prefer-dist --no-progress

- name: Lint
if: matrix.php-version == '8.4'
run: |
PHP_CS_FIXER_IGNORE_ENV=True vendor/bin/php-cs-fixer fix --diff --dry-run
vendor/bin/php-cs-fixer fix --diff --dry-run

- name: PHPUnit
run: |
vendor/bin/phpunit --colors --coverage-text --coverage-clover coverage/clover.xml
vendor/bin/phpunit --colors --display-all-issues --coverage-text --coverage-clover coverage/clover.xml

- name: Upload coverage
uses: codecov/codecov-action@v6
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"php-cs-fixer fix -vvv"
],
"test": [
"phpunit --colors --coverage-html ./coverage"
"phpunit --colors --display-all-issues --coverage-html ./coverage"
]
}
}
7 changes: 6 additions & 1 deletion src/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ public static function escAttr(mixed $text, string $charset = 'UTF-8'): string

$text = \preg_replace_callback('/[^a-z0-9,.\-_]/iSu', static function ($matches) {
$chr = $matches[0];
$ord = \ord($chr);

if (\strlen($chr) === 1) {
$ord = \ord($chr);
} else {
$ord = \mb_ord($chr, 'UTF-8');
}

if (($ord <= 0x1F && $chr !== "\t" && $chr !== "\n" && $chr !== "\r")
|| ($ord >= 0x7F && $ord <= 0x9F)
Expand Down
2 changes: 1 addition & 1 deletion tests/SecurityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public function testCharsetNotSupportedException(): void

public function testInvalidCharacter(): void
{
$invalidChar = \chr(99999999);
$invalidChar = "\xFF";
$countThrownExceptions = 0;

try {
Expand Down