Skip to content
Closed
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

## <a name="dependencies"></a> Dependencies

- [v5.6 <= PHP <= v7.0.15](http://php.net/downloads.php)
- [PHP >= 8.1](http://php.net/downloads.php)

## <a name="installation"></a> Installation

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"type": "library",
"require": {
"mustache/mustache": "^2.11.1",
"guzzlehttp/guzzle": "~6.0",
"php": ">=5.5",
"guzzlehttp/guzzle": "^7.0",
"php": ">=8.1",
"psr/log": "^1.0.2"
},
"config": {
Expand All @@ -27,8 +27,8 @@
}
},
"require-dev": {
"phpunit/phpunit": "5.6.*",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "^7.5",
"mockery/mockery": "^1.3",
"overtrue/phplint": "^1.1"
},
"autoload-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/CookieV3.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct($pxCtx, $pxConfig)

$payloadParts = explode(":", $pxCtx->getPxCookie());
if (count($payloadParts) < $cookieValidPartsNumber) {
return null;
throw new PerimeterxException("Invalid cookie format: expected at least {$cookieValidPartsNumber} parts");
}
list($hash, $cookie) = explode(":", $pxCtx->getPxCookie(), 2);
$this->pxPayload = $cookie;
Expand Down
4 changes: 2 additions & 2 deletions src/PerimeterxContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function __construct($pxConfig, $additionalFields = null)
}
$this->http_method = $_SERVER['REQUEST_METHOD'];
$this->sensitive_route = $this->checkSensitiveRoutePrefix($pxConfig['sensitive_routes'], $this->uri);
$this->loginCredentials = array_key_exists('loginCredentials', $additionalFields) ? $additionalFields['loginCredentials'] : null;
$this->graphqlFields = array_key_exists('graphqlFields', $additionalFields) ? $additionalFields['graphqlFields'] : null;
$this->loginCredentials = (is_array($additionalFields) && array_key_exists('loginCredentials', $additionalFields)) ? $additionalFields['loginCredentials'] : null;
$this->graphqlFields = (is_array($additionalFields) && array_key_exists('graphqlFields', $additionalFields)) ? $additionalFields['graphqlFields'] : null;
$this->requestId = PerimeterxUtils::createUuidV4();
}

Expand Down
2 changes: 1 addition & 1 deletion src/TokenV3.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct($pxCtx, $pxConfig, $payload)

$payloadParts = explode(":", $payload);
if (count($payloadParts) < $cookieValidPartsNumber) {
return null;
throw new PerimeterxException("Invalid token format: expected at least {$cookieValidPartsNumber} parts");
}
list($hash, $token) = explode(":", $payload, 2);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
use PHPUnit\Framework\TestCase;

use Perimeterx\CredentialsIntelligence\Protocol\V2CredentialsIntelligenceProtocol;
use Perimeterx\CredentialsIntelligence\LoginCredentialsFields;
use Perimeterx\CredentialsIntelligence\Protocol\CIVersion;

class V2CredentialsIntelligenceProtocolTests extends PHPUnit_Framework_TestCase {
class V2CredentialsIntelligenceProtocolTests extends PHPUnit\Framework\TestCase {

/**
* @dataProvider provideCredentialsAndExpectedHashes
Expand Down
6 changes: 3 additions & 3 deletions tests/PerimeterxConfigurationValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
use PHPUnit\Framework\TestCase;
use Perimeterx\Perimeterx;

class PerimeterxConfigurationValidatorTest extends PHPUnit_Framework_TestCase
class PerimeterxConfigurationValidatorTest extends TestCase
{

protected $params;
protected $px;

protected function setUp()
protected function setUp(): void
{
$this->params = [
'app_id' => 'PX_APP_ID',
Expand All @@ -20,7 +20,7 @@ protected function setUp()
];
}

protected function tearDown()
protected function tearDown(): void
{
$reflection = new ReflectionClass($this->px);
$instance = $reflection->getProperty('instance');
Expand Down
2 changes: 1 addition & 1 deletion tests/PerimeterxCookieV3ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\AbstractLogger;

class PerimeterxCookieV3ValidatorTest extends PHPUnit_Framework_TestCase
class PerimeterxCookieV3ValidatorTest extends PHPUnit\Framework\TestCase
{

// randomly generated fake values
Expand Down
2 changes: 1 addition & 1 deletion tests/PerimeterxCookieValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\AbstractLogger;

class PerimeterxCookieValidatorTest extends PHPUnit_Framework_TestCase
class PerimeterxCookieValidatorTest extends PHPUnit\Framework\TestCase
{

// randomly generated fake values
Expand Down
2 changes: 1 addition & 1 deletion tests/PerimeterxDataEnrichmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\AbstractLogger;

class PerimeterxDataEnrichmentTest extends PHPUnit_Framework_TestCase {
class PerimeterxDataEnrichmentTest extends PHPUnit\Framework\TestCase {
const COOKIE_KEY = '549Z5UsasvfmVS6kAR3r4ydPnQdnnW4Gcwk35hj5tatZ5B2dqjrQvMMyLAJN5de3';

public function testNoPxdeCookie() {
Expand Down
5 changes: 3 additions & 2 deletions tests/PerimeterxFieldExtractorManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
use Perimeterx\CredentialsIntelligence\PerimeterxFieldExtractor;
use Perimeterx\CredentialsIntelligence\PerimeterxFieldExtractorManager;
use Perimeterx\CredentialsIntelligence\Protocol\V1CredentialsIntelligenceProtocol;
use PHPUnit\Framework\TestCase;

class PerimeterxFieldExtractorManagerTest extends PHPUnit_Framework_TestCase
class PerimeterxFieldExtractorManagerTest extends TestCase
{
const LOGIN_REQUEST_URI = "/login";
const LOGIN_REQUEST_METHOD = "POST";
Expand All @@ -32,7 +33,7 @@ class PerimeterxFieldExtractorManagerTest extends PHPUnit_Framework_TestCase
*/
private $fieldExtractorManager;

public function setUp() {
protected function setUp(): void {
$mapKey = PerimeterxFieldExtractorManager::generateMapKey(self::LOGIN_REQUEST_URI, self::LOGIN_REQUEST_METHOD);
$mockExtractor = $this->createMock(PerimeterxFieldExtractor::class);
$mockExtractor
Expand Down
3 changes: 2 additions & 1 deletion tests/PerimeterxFirstPartyClientTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use PHPUnit\Framework\TestCase;

use GuzzleHttp\Psr7\Response;
use Perimeterx\PerimeterxFirstPartyClient;
Expand All @@ -7,7 +8,7 @@
use PerimeterxTests\MockHttpClient;
use PerimeterxTests\TestUtils;

class PerimeterxFirstPartyClientTest extends PHPUnit_Framework_TestCase {
class PerimeterxFirstPartyClientTest extends PHPUnit\Framework\TestCase {
private function getTestPxConfig() {
$pxConfig = [
'app_id' => 'PX_APP_ID',
Expand Down
2 changes: 1 addition & 1 deletion tests/PerimeterxOriginalTokenValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\AbstractLogger;

class PerimeterxOriginalTokenValidatorTest extends PHPUnit_Framework_TestCase
class PerimeterxOriginalTokenValidatorTest extends PHPUnit\Framework\TestCase
{
// randomly generated fake values
const COOKIE_KEY = '549Z5UsasvfmVS6kAR3r4ydPnQdnnW4Gcwk35hj5tatZ5B2dqjrQvMMyLAJN5de3';
Expand Down
3 changes: 2 additions & 1 deletion tests/PerimeterxS2SValidatorTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php
use PHPUnit\Framework\TestCase;

use Perimeterx\Perimeterx;
use Perimeterx\PerimeterxContext;
use Perimeterx\PerimeterxS2SValidator;
use Perimeterx\PerimeterxHttpClient;
use Psr\Log\AbstractLogger;

class PerimeterxS2SValidatorTest extends PHPUnit_Framework_TestCase
class PerimeterxS2SValidatorTest extends PHPUnit\Framework\TestCase
{
// randomly generated fake values
const COOKIE_KEY = '549Z5UsasvfmVS6kAR3r4ydPnQdnnW4Gcwk35hj5tatZ5B2dqjrQvMMyLAJN5de3';
Expand Down
7 changes: 4 additions & 3 deletions tests/PerimeterxUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@

use Perimeterx\PerimeterxUtils;
use PerimeterxTests\TestUtils;
use PHPUnit\Framework\TestCase;

class PerimeterxUtilsDouble extends PerimeterxUtils {
public static function setInputStreamName($inputStreamName) {
static::$inputStreamName = $inputStreamName;
}
}

class PerimeterxUtilsTest extends PHPUnit_Framework_TestCase {
class PerimeterxUtilsTest extends TestCase {
const TEMP_STREAM_NAME = "file://" . __DIR__ . "/tmp.txt";

public function setUp() {
protected function setUp(): void {
PerimeterxUtilsDouble::setInputStreamName(self::TEMP_STREAM_NAME);
}

public function tearDown() {
protected function tearDown(): void {
if (file_exists(self::TEMP_STREAM_NAME)) {
unlink(self::TEMP_STREAM_NAME);
}
Expand Down