framework icon indicating copy to clipboard operation
framework copied to clipboard

Undefined variable $result in Container.php

Open frkcn opened this issue 5 days ago • 5 comments

Laravel Version

12.42.0

PHP Version

8.5.0

Database Driver & Version

MySQL 8.0.42

Description

When running php artisan schedule:run, an ErrorException: Undefined variable $result is thrown in Container.php. The error occurs in the following code path:

if ($this->resolved($abstract)) {
    $this->rebound($abstract);
}

return $result;  // <-- $result is undefined

It appears that $result is being returned without being defined in certain code paths within the Container class.

Image

Steps To Reproduce

Run php artisan schedule:run (the exact trigger may vary) The error is thrown from Illuminate\Container\Container.php

Stack Trace:
ErrorException: Undefined variable $result

vendor/laravel/framework/src/Illuminate/Container/Container.php
  in Illuminate\Foundation\Bootstrap\HandleExceptions::handleError
Environment

Expected Behavior The container method should properly initialize and return $result in all code paths without throwing an undefined variable error. Additional Context This error was captured in production via error monitoring. The breadcrumbs show:

artisan.command → Finished artisan command: schedule:run The error triggers during the command execution lifecycle

frkcn avatar Dec 10 '25 07:12 frkcn