We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9ce0eee commit 94cc5afCopy full SHA for 94cc5af
src/crawler.php
@@ -86,7 +86,11 @@
86
function getBaseDir(): string
87
{
88
if (stripos(PHP_OS, 'CYGWIN') !== false) {
89
- return rtrim(platformCompatiblePath($_SERVER['SCRIPT_DIR'], '/'), '/ ');
+ if (isset($_SERVER['SCRIPT_DIR']) && $_SERVER['SCRIPT_DIR'] && preg_match(':\/', $_SERVER['SCRIPT_DIR']) === 1) {
90
+ return rtrim(platformCompatiblePath($_SERVER['SCRIPT_DIR']), '/ ');
91
+ } else {
92
+ return dirname(platformCompatiblePath($_SERVER['SCRIPT_FILENAME']), 2);
93
+ }
94
} else {
95
$scriptRealPath = str_starts_with($_SERVER['SCRIPT_FILENAME'], '/') ? $_SERVER['SCRIPT_FILENAME'] : realpath($_SERVER['SCRIPT_FILENAME']);
96
return dirname(platformCompatiblePath($scriptRealPath), 2);
0 commit comments