Skip to content

Commit 5ad9c1e

Browse files
xamountjfritschi
authored andcommitted
More robust check for Windows OS in File.php (#275)
A common pattern in PHP configurations is to have environment variables turned off. This means on line 125 getenv("OS") will fail and Windows will fail to be detected. Therefore I've added Windows detection using the PHP_OS constant as a fallback.
1 parent 7a949de commit 5ad9c1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/CAS/PGTStorage/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function __construct($cas_parent,$path)
122122
$path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
123123
}
124124
// check that the path is an absolute path
125-
if (getenv("OS")=="Windows_NT") {
125+
if (getenv("OS")=="Windows_NT" || strtoupper(substr(PHP_OS,0,3)) == 'WIN') {
126126

127127
if (!preg_match('`^[a-zA-Z]:`', $path)) {
128128
phpCAS::error('an absolute path is needed for PGT storage to file');
@@ -258,4 +258,4 @@ function read($pgt_iou)
258258
/** @} */
259259

260260
}
261-
?>
261+
?>

0 commit comments

Comments
 (0)