From 9e41eba401f17f80014c8c2204d5dc692816dbcc Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 21 Mar 2021 13:57:56 +0100 Subject: [PATCH] Bugfix: Add path checks for windows. --- lib/Doctrine/Deprecations/Deprecation.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/Deprecations/Deprecation.php b/lib/Doctrine/Deprecations/Deprecation.php index 4375889..1029372 100644 --- a/lib/Doctrine/Deprecations/Deprecation.php +++ b/lib/Doctrine/Deprecations/Deprecation.php @@ -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; } }