Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest]
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.2']
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
name: Unit Tests for PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
steps:
- name: Checkout
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"freedsx/socket": ">=0.3,<1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2",
"phpspec/phpspec": "^5.1|^6.1|^7.1",
"phpstan/phpstan": "^0.11|^0.12",
"phpunit/phpunit": "^7.5|^8.5|^9.5",
"symfony/process": "^3|^4|^5"
"friendsofphp/php-cs-fixer": "^2.19 || ^3.0",
"phpspec/phpspec": "^5.1 || ^6.1 || ^7.1 || ^8.0",
"phpstan/phpstan": "^0.12.99 || ^1.12 || ^2.1",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"symfony/process": "^3.4 || ^4.4 || ^5.4 || ^6.4 || ^7.0"
},
"suggest": {
"ext-openssl": "For SNMP privacy encryption support.",
Expand Down
2 changes: 1 addition & 1 deletion src/FreeDSx/Snmp/Message/AbstractMessageV3.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ abstract class AbstractMessageV3 implements PduInterface
public function __construct(
MessageHeader $header,
?ScopedPdu $scopedPdu,
string $encryptedPdu = null,
?string $encryptedPdu = null,
?SecurityParametersInterface $securityParams = null
) {
$this->header = $header;
Expand Down
8 changes: 6 additions & 2 deletions src/FreeDSx/Snmp/Module/Privacy/PrivacyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,16 @@ protected function setPduDataInMessage(AbstractMessageV3 $message, $encryptedDat

if (!$encOnly) {
$pduProperty = $requestObject->getProperty('scopedPdu');
$pduProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$pduProperty->setAccessible(true);
}
Comment on lines +294 to +296

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunately very hacky but needed. I'll revisit all this when I actually upgrade the PHP version requirements for this library.

$pduProperty->setValue($message, $pdu);
}

$encryptedProperty = $requestObject->getProperty('encryptedPdu');
$encryptedProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$encryptedProperty->setAccessible(true);
}
$encryptedProperty->setValue($message, $encryptedData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -773,15 +773,21 @@ protected function setupOutgoingMessage(
$scopedPduObject = new \ReflectionObject($scopedPdu);

$secParamsProperty = $msgObject->getProperty('securityParams');
$secParamsProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$secParamsProperty->setAccessible(true);
}
$secParamsProperty->setValue($message, $secParams);

$encryptedProperty = $msgObject->getProperty('encryptedPdu');
$encryptedProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$encryptedProperty->setAccessible(true);
}
$encryptedProperty->setValue($message, null);

$contextEngineIdProperty = $scopedPduObject->getProperty('contextEngineId');
$contextEngineIdProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$contextEngineIdProperty->setAccessible(true);
}
$contextEngineIdProperty->setValue($message->getScopedPdu(), $secParams->getEngineId());
}

Expand Down
4 changes: 3 additions & 1 deletion src/FreeDSx/Snmp/Protocol/ClientProtocolHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ protected function setPduId(Pdu $request, int $id) : void
}
$requestObject = new \ReflectionObject($request);
$idProperty = $requestObject->getProperty('id');
$idProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$idProperty->setAccessible(true);
}
$idProperty->setValue($request, $id);
}

Expand Down
4 changes: 3 additions & 1 deletion src/FreeDSx/Snmp/Protocol/ProtocolTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ protected function setPduId($pdu, int $id) : void
}
$requestObject = new \ReflectionObject($pdu);
$idProperty = $requestObject->getProperty('id');
$idProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$idProperty->setAccessible(true);
}
$idProperty->setValue($pdu, $id);
}

Expand Down
Loading