Skip to content

Commit

Permalink
Bugfix: Add path checks for windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 21, 2021
1 parent 816a70b commit 9e41eba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Doctrine/Deprecations/Deprecation.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ public static function triggerIfCalledFromOutside(string $package, string $link,
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);

// first check that the caller is not from a tests folder, in which case we always let deprecations pass
if (strpos($backtrace[1]['file'], '/tests/') === false) {
if (strpos($backtrace[0]['file'], '/vendor/' . $package . '/') === false) {
if (strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) {
$path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR;

if (strpos($backtrace[0]['file'], $path) === false) {
return;
}

if (strpos($backtrace[1]['file'], '/vendor/' . $package . '/') !== false) {
if (strpos($backtrace[1]['file'], $path) !== false) {
return;
}
}
Expand Down

0 comments on commit 9e41eba

Please sign in to comment.