Skip to content

Commit 57fa31c

Browse files
DeyVDawid 'DeyV' Polak
and
Dawid 'DeyV' Polak
authored
Fix #377 - undefined variables (#417)
* Fix #377 - undefined variables & remove tests for php 7.1 Co-authored-by: Dawid 'DeyV' Polak <[email protected]>
1 parent 1e7d36e commit 57fa31c

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
php-version:
15-
- php: '7.1'
16-
phpunit: '7.5'
1715
- php: '7.2'
18-
phpunit: '8'
16+
phpunit: '8'
1917
- php: '7.3'
20-
phpunit: latest
18+
phpunit: latest
2119
- php: '7.4'
22-
phpunit: latest
20+
phpunit: latest
2321
- php: '8.0'
24-
phpunit: latest
25-
22+
phpunit: latest
23+
- php: '8.1'
24+
phpunit: latest
2625
steps:
2726
- uses: actions/checkout@v2
2827
- uses: php-actions/composer@v6

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
"require" : {
2525
"php" : ">=7.1.0",
2626
"ext-curl" : "*",
27+
"ext-dom" : "*",
2728
"psr/log" : "^1.0 || ^2.0 || ^3.0"
28-
},
29+
},
2930
"require-dev" : {
3031
"monolog/monolog" : "^1.0.0",
31-
"phpunit/phpunit" : ">=7.5"
32+
"phpunit/phpunit" : ">=7.5",
33+
"phpstan/phpstan" : "^1.5"
3234
},
3335
"autoload" : {
3436
"classmap" : [
@@ -42,7 +44,8 @@
4244
}
4345
},
4446
"scripts" : {
45-
"test" : "phpunit"
47+
"test" : "phpunit",
48+
"phpstan" : "phpstan"
4649
},
4750
"extra" : {
4851
"branch-alias" : {

source/CAS/Client.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ public function isAuthenticated($renew=false)
15731573
{
15741574
phpCAS::traceBegin();
15751575
$res = false;
1576-
$validate_url = '';
1576+
15771577
if ( $this->_wasPreviouslyAuthenticated() ) {
15781578
if ($this->hasTicket()) {
15791579
// User has a additional ticket but was already authenticated
@@ -1607,6 +1607,10 @@ public function isAuthenticated($renew=false)
16071607
$this->markAuthenticationCall($res);
16081608
} else {
16091609
if ($this->hasTicket()) {
1610+
$validate_url = '';
1611+
$text_response = '';
1612+
$tree_response = '';
1613+
16101614
switch ($this->getServerVersion()) {
16111615
case CAS_VERSION_1_0:
16121616
// if a Service Ticket was given, validate it
@@ -1670,7 +1674,7 @@ public function isAuthenticated($renew=false)
16701674
$logoutTicket = $this->getTicket();
16711675
break;
16721676
default:
1673-
phpCAS::trace('Protocoll error');
1677+
phpCAS::trace('Protocol error');
16741678
break;
16751679
}
16761680
} else {
@@ -2179,6 +2183,8 @@ public function validateCAS10(&$validate_url,&$text_response,&$tree_response,$re
21792183
$validate_url .= '&renew=true';
21802184
}
21812185

2186+
$headers = '';
2187+
$err_msg = '';
21822188
// open and read the URL
21832189
if ( !$this->_readURL($validate_url, $headers, $text_response, $err_msg) ) {
21842190
phpCAS::trace(
@@ -2255,6 +2261,8 @@ public function validateSA(&$validate_url,&$text_response,&$tree_response,$renew
22552261
$validate_url .= '&renew=true';
22562262
}
22572263

2264+
$headers = '';
2265+
$err_msg = '';
22582266
// open and read the URL
22592267
if ( !$this->_readURL($validate_url, $headers, $text_response, $err_msg) ) {
22602268
phpCAS::trace(
@@ -2912,6 +2920,8 @@ public function retrievePT($target_service,&$err_code,&$err_msg)
29122920
$cas_url = $this->getServerProxyURL().'?targetService='
29132921
.urlencode($target_service).'&pgt='.$this->_getPGT();
29142922

2923+
$headers = '';
2924+
$cas_response = '';
29152925
// open and read the URL
29162926
if ( !$this->_readURL($cas_url, $headers, $cas_response, $err_msg) ) {
29172927
phpCAS::trace(

0 commit comments

Comments
 (0)