Skip to content

Update QueryCollector.php fix issue #1775 #1776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Mathias-DS
Copy link
Contributor

Test for null value in strpos in QueryCollector.php to solve laravel-debugbar issue #1775 and snipe-it issue 16476.

Test for null value in strpos in QueryCollector.php to solve laravel-debugbar issue barryvdh#1775 and snipe-it issue 16476.
@@ -378,7 +378,7 @@ protected function findMiddlewareFromFile($file)
$filename = pathinfo($file, PATHINFO_FILENAME);

foreach ($this->middleware as $alias => $class) {
if (strpos($class, $filename) !== false) {
if (!is_null($class) && !is_null($filename) && strpos($class, $filename) !== false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't it be something simpler? like

if ($class && strpos($class, (string) $filename) !== false) {
Suggested change
if (!is_null($class) && !is_null($filename) && strpos($class, $filename) !== false) {
if ($class && strpos($class, (string) $filename) !== false) {

@barryvdh barryvdh merged commit 611c2d1 into barryvdh:master Apr 8, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants