-
-
Notifications
You must be signed in to change notification settings - Fork 116
Compatibility with PHP8.5 #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c51d329
13e885b
0b087d9
69bd8dc
c62840a
7153d2c
4b9f2b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,15 @@ | ||
| <phpunit bootstrap="tests/bootstrap.php"> | ||
| <testsuite name="Anti-XSS Test Suite"> | ||
| <directory>tests</directory> | ||
| </testsuite> | ||
| <filter> | ||
| <whitelist processUncoveredFilesFromWhitelist="true"> | ||
| <directory suffix=".php">./src/</directory> | ||
| </whitelist> | ||
| </filter> | ||
| <logging> | ||
| <log type="coverage-clover" target="build/logs/clover.xml"/> | ||
| </logging> | ||
| <?xml version="1.0"?> | ||
| <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
| <coverage processUncoveredFiles="true"> | ||
| <include> | ||
| <directory suffix=".php">./src/</directory> | ||
| </include> | ||
| <report> | ||
| <clover outputFile="build/logs/clover.xml"/> | ||
| </report> | ||
| </coverage> | ||
| <testsuite name="Anti-XSS Test Suite"> | ||
| <directory>tests</directory> | ||
| </testsuite> | ||
| <logging/> | ||
|
Comment on lines
+1
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PHPUnit configuration may not be compatible with PHP 7.0-7.2. This configuration uses PHPUnit 9.3+ schema with PHPUnit 6/7 uses the old
Consider keeping both config files or using PHPUnit's ability to auto-detect configuration format. #!/bin/bash
# Verify PHPUnit version constraints in composer.json
cat composer.json | jq '.["require-dev"]["phpunit/phpunit"]'🤖 Prompt for AI Agents |
||
| </phpunit> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,6 @@ public function testNoXss() | |
| '<a href="https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_15446515888862039806%22%7D&n_type=0&p_from=1" target="_blank">Valid Link</a>' => '<a href="https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_15446515888862039806%22%7D&n_type=0&p_from=1" target="_blank">Valid Link</a>', | ||
| '' => '', | ||
| ' ' => ' ', | ||
| null => '', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| true => 1, | ||
| false => 0, | ||
| 0 => 0, | ||
|
|
@@ -2122,7 +2121,11 @@ public function invokeMethod(&$object, $methodName, array $parameters = []) | |
| { | ||
| $reflection = new \ReflectionObject($object); | ||
| $method = $reflection->getMethod($methodName); | ||
| $method->setAccessible(true); | ||
|
|
||
| // setAccessible() is required for PHP < 8.1, deprecated in 8.1+ | ||
| if (\PHP_VERSION_ID < 80100) { | ||
| $method->setAccessible(true); | ||
| } | ||
|
|
||
| return $method->invokeArgs($object, $parameters); | ||
|
Comment on lines
2122
to
2130
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The call to $reflection = new \ReflectionObject($object);
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);
return $method->invokeArgs($object, $parameters); |
||
| } | ||
|
|
@@ -2139,7 +2142,11 @@ public function invokeProperty(&$object, $propertyName) | |
| { | ||
| $reflection = new \ReflectionObject($object); | ||
| $property = $reflection->getProperty($propertyName); | ||
| $property->setAccessible(true); | ||
|
|
||
| // setAccessible() is required for PHP < 8.1, deprecated in 8.1+ | ||
| if (\PHP_VERSION_ID < 80100) { | ||
| $property->setAccessible(true); | ||
| } | ||
|
|
||
| return $property->getValue($object); | ||
|
Comment on lines
2143
to
2151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the $reflection = new \ReflectionObject($object);
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
return $property->getValue($object); |
||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.