Symfony Exception

ErrorException

HTTP 500 Internal Server Error

Attempt to read property "app_code" on null

Exception

ErrorException

  1.         $data['line_color'] = $lineColor;
  2.         if ($lineColor) {
  3.             $data['auto_color'] = false;
  4.         }
  5.         return $this->wxa->app_code->getUnlimit($scene$data);
  6.     }
  7.     /**
  8.      * 为授权的小程序帐号上传小程序代码
  9.      *
  1.     protected function registerErrorHandling()
  2.     {
  3.         error_reporting(-1);
  4.         set_error_handler(function ($level$message$file ''$line 0) {
  5.             $this->handleError($level$message$file$line);
  6.         });
  7.         set_exception_handler(function ($e) {
  8.             $this->handleException($e);
  9.         });
Application->Laravel\Lumen\Concerns\{closure}() in /data/httpd/src/WechatBundle/Services/WeappService.php (line 474)
  1.         $data['line_color'] = $lineColor;
  2.         if ($lineColor) {
  3.             $data['auto_color'] = false;
  4.         }
  5.         return $this->wxa->app_code->getUnlimit($scene$data);
  6.     }
  7.     /**
  8.      * 为授权的小程序帐号上传小程序代码
  9.      *
WeappService->createWxaCodeUnlimit() in /data/httpd/src/WechatBundle/Http/Controllers/Qrcode.php (line 70)
  1.                 unset($input[$key]);
  2.             }
  3.         }
  4.         $share_id $weappService->getShareId($companyId$input);
  5.         $scene http_build_query(['share_id' => $share_id]);
  6.         $qrcode $weappService->createWxaCodeUnlimit($scene$page);
  7.         return Response($qrcode)->header('Content-type''image/png');
  8.     }
  9.     /**
  1.         if (static::isCallableWithAtSign($callback) || $defaultMethod) {
  2.             return static::callClass($container$callback$parameters$defaultMethod);
  3.         }
  4.         return static::callBoundMethod($container$callback, function () use ($container$callback$parameters) {
  5.             return $callback(...array_values(static::getMethodDependencies($container$callback$parameters)));
  6.         });
  7.     }
  8.     /**
  9.      * Call a string reference to a class using Class@method syntax.
in /data/httpd/vendor/illuminate/container/Util.php :: Illuminate\Container\{closure} (line 40)
  1.      * @param  mixed  $value
  2.      * @return mixed
  3.      */
  4.     public static function unwrapIfClosure($value)
  5.     {
  6.         return $value instanceof Closure $value() : $value;
  7.     }
  8.     /**
  9.      * Get the class name of the given parameter's type, if possible.
  10.      *
  1.         if ($container->hasMethodBinding($method)) {
  2.             return $container->callMethodBinding($method$callback[0]);
  3.         }
  4.         return Util::unwrapIfClosure($default);
  5.     }
  6.     /**
  7.      * Normalize the given callback into a Class@method string.
  8.      *
  1.         if (static::isCallableWithAtSign($callback) || $defaultMethod) {
  2.             return static::callClass($container$callback$parameters$defaultMethod);
  3.         }
  4.         return static::callBoundMethod($container$callback, function () use ($container$callback$parameters) {
  5.             return $callback(...array_values(static::getMethodDependencies($container$callback$parameters)));
  6.         });
  7.     }
  8.     /**
  1.      *
  2.      * @throws \InvalidArgumentException
  3.      */
  4.     public function call($callback, array $parameters = [], $defaultMethod null)
  5.     {
  6.         return BoundMethod::call($this$callback$parameters$defaultMethod);
  7.     }
  8.     /**
  9.      * Get a closure to resolve the given type from the container.
  10.      *
  1.      */
  2.     protected function callControllerCallable(callable $callable, array $parameters = [])
  3.     {
  4.         try {
  5.             return $this->prepareResponse(
  6.                 $this->call($callable$parameters)
  7.             );
  8.         } catch (HttpResponseException $e) {
  9.             return $e->getResponse();
  10.         }
  11.     }
  1.         if (count($middleware) > 0) {
  2.             return $this->callLumenControllerWithMiddleware(
  3.                 $instance$method$routeInfo$middleware
  4.             );
  5.         } else {
  6.             return $this->callControllerCallable(
  7.                 [$instance$method], $routeInfo[2]
  8.             );
  9.         }
  10.     }
  1.         if (! method_exists($instance $this->make($controller), $method)) {
  2.             throw new NotFoundHttpException;
  3.         }
  4.         if ($instance instanceof LumenController) {
  5.             return $this->callLumenController($instance$method$routeInfo);
  6.         } else {
  7.             return $this->callControllerCallable(
  8.                 [$instance$method], $routeInfo[2]
  9.             );
  10.         }
  1.     protected function callActionOnArrayBasedRoute($routeInfo)
  2.     {
  3.         $action $routeInfo[1];
  4.         if (isset($action['uses'])) {
  5.             return $this->prepareResponse($this->callControllerAction($routeInfo));
  6.         }
  7.         foreach ($action as $value) {
  8.             if ($value instanceof Closure) {
  9.                 $callable $value->bindTo(new RoutingClosure);
  1.                 return $this->callActionOnArrayBasedRoute($this['request']->route());
  2.             }));
  3.         }
  4.         return $this->prepareResponse(
  5.             $this->callActionOnArrayBasedRoute($routeInfo)
  6.         );
  7.     }
  8.     /**
  9.      * Call the Closure or invokable on the array based route.
  1.             return $this->sendThroughPipeline($this->middleware, function ($request) use ($method$pathInfo) {
  2.                 $this->instance(Request::class, $request);
  3.                 if (isset($this->router->getRoutes()[$method.$pathInfo])) {
  4.                     return $this->handleFoundRoute([true$this->router->getRoutes()[$method.$pathInfo]['action'], []]);
  5.                 }
  6.                 return $this->handleDispatcherResponse(
  7.                     $this->createDispatcher()->dispatch($method$pathInfo)
  8.                 );
in /data/httpd/vendor/laravel/lumen-framework/src/Routing/Pipeline.php -> Laravel\Lumen\Concerns\{closure} (line 48)
  1.      */
  2.     protected function prepareDestination(BaseClosure $destination)
  3.     {
  4.         return function ($passable) use ($destination) {
  5.             try {
  6.                 return $destination($passable);
  7.             } catch (Throwable $e) {
  8.                 return $this->handleException($passable$e);
  9.             }
  10.         };
  11.     }
Pipeline->Laravel\Lumen\Routing\{closure}() in /data/httpd/app/Http/Middleware/SetLocaleMiddleware.php (line 24)
  1.         if ($country_code) {
  2.             app()->setLocale($country_code);
  3.         }else{
  4.             app()->setLocale('zh-CN');
  5.         }
  6.         return $next($request);
  7.     }
  8. }
  1.                         // since the object we're given was already a fully instantiated object.
  2.                         $parameters = [$passable$stack];
  3.                     }
  4.                     $carry method_exists($pipe$this->method)
  5.                                     ? $pipe->{$this->method}(...$parameters)
  6.                                     : $pipe(...$parameters);
  7.                     return $this->handleCarry($carry);
  8.                 } catch (Throwable $e) {
  9.                     return $this->handleException($passable$e);
in /data/httpd/vendor/laravel/lumen-framework/src/Routing/Pipeline.php -> Illuminate\Pipeline\{closure} (line 30)
  1.         return function ($stack$pipe) {
  2.             return function ($passable) use ($stack$pipe) {
  3.                 try {
  4.                     $slice parent::carry();
  5.                     return ($slice($stack$pipe))($passable);
  6.                 } catch (Throwable $e) {
  7.                     return $this->handleException($passable$e);
  8.                 }
  9.             };
  10.         };
in /data/httpd/vendor/illuminate/pipeline/Pipeline.php -> Laravel\Lumen\Routing\{closure} (line 103)
  1.     {
  2.         $pipeline array_reduce(
  3.             array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  4.         );
  5.         return $pipeline($this->passable);
  6.     }
  7.     /**
  8.      * Run the pipeline and return the result.
  9.      *
  1.     {
  2.         if (count($middleware) > && ! $this->shouldSkipMiddleware()) {
  3.             return (new Pipeline($this))
  4.                 ->send($this->make('request'))
  5.                 ->through($middleware)
  6.                 ->then($then);
  7.         }
  8.         return $then($this->make('request'));
  9.     }
  1.         [$method$pathInfo] = $this->parseIncomingRequest($request);
  2.         try {
  3.             $this->boot();
  4.             return $this->sendThroughPipeline($this->middleware, function ($request) use ($method$pathInfo) {
  5.                 $this->instance(Request::class, $request);
  6.                 if (isset($this->router->getRoutes()[$method.$pathInfo])) {
  7.                     return $this->handleFoundRoute([true$this->router->getRoutes()[$method.$pathInfo]['action'], []]);
  8.                 }
Application->dispatch() in /data/httpd/app/AppKernel.php (line 73)
  1.         }
  2.     }
  3.     public function directDispatch($request null)
  4.     {
  5.         return parent::dispatch($request);
  6.     }
  7. }
AppKernel->directDispatch() in /data/httpd/app/AppKernel.php (line 55)
  1.         try {
  2.             $this->boot();
  3.             $response $dingoRequest->handle($this['request'], function($request) {
  4.                 // 当api路由找不到时
  5.                 return $this->directDispatch($request);
  6.             });
  7.             // 统一http响应状态码
  8.             $statusCode $response->getStatusCode();
  9.             if ($statusCode != 200 && $statusCode != 401) {
  10.                 $response->setStatusCode(200);
  1.             $this->exception->report($exception);
  2.             return $this->exception->handle($exception);
  3.         }
  4.         return $next($request);
  5.     }
  6.     /**
  7.      * Send the request through the Dingo router.
  8.      *
Request->handle() in /data/httpd/app/AppKernel.php (line 53)
  1.         $dingoRequest $this->make(DingoRequest::class);
  2.         try {
  3.             $this->boot();
  4.             $response $dingoRequest->handle($this['request'], function($request) {
  5.                 // 当api路由找不到时
  6.                 return $this->directDispatch($request);
  7.             });
  8.             // 统一http响应状态码
  9.             $statusCode $response->getStatusCode();
  1.      * @param  \Symfony\Component\HttpFoundation\Request|null  $request
  2.      * @return void
  3.      */
  4.     public function run($request null)
  5.     {
  6.         $response $this->dispatch($request);
  7.         if ($response instanceof SymfonyResponse) {
  8.             $response->send();
  9.         } else {
  10.             echo (string) $response;
Application->run() in /data/httpd/public/index.php (line 31)
  1. | the client's browser allowing them to enjoy the creative
  2. | and wonderful application we have prepared for them.
  3. |
  4. */
  5. $app->run();
  6. // 结束分析
  7. # $xhprof_data = xhprof_disable();
  8. # $XHPROF_ROOT = realpath(dirname(__FILE__) .'/..');
  9. # include_once $XHPROF_ROOT . "/xhprof/xhprof_lib/utils/xhprof_lib.php";

Stack Trace

ErrorException
ErrorException:
Attempt to read property "app_code" on null

  at /data/httpd/src/WechatBundle/Services/WeappService.php:474
  at Laravel\Lumen\Application->handleError()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php:47)
  at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
     (/data/httpd/src/WechatBundle/Services/WeappService.php:474)
  at WechatBundle\Services\WeappService->createWxaCodeUnlimit()
     (/data/httpd/src/WechatBundle/Http/Controllers/Qrcode.php:70)
  at WechatBundle\Http\Controllers\Qrcode->getQrcode()
     (/data/httpd/vendor/illuminate/container/BoundMethod.php:36)
  at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
     (/data/httpd/vendor/illuminate/container/Util.php:40)
  at Illuminate\Container\Util::unwrapIfClosure()
     (/data/httpd/vendor/illuminate/container/BoundMethod.php:93)
  at Illuminate\Container\BoundMethod::callBoundMethod()
     (/data/httpd/vendor/illuminate/container/BoundMethod.php:35)
  at Illuminate\Container\BoundMethod::call()
     (/data/httpd/vendor/illuminate/container/Container.php:653)
  at Illuminate\Container\Container->call()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:389)
  at Laravel\Lumen\Application->callControllerCallable()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:354)
  at Laravel\Lumen\Application->callLumenController()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:329)
  at Laravel\Lumen\Application->callControllerAction()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:282)
  at Laravel\Lumen\Application->callActionOnArrayBasedRoute()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:267)
  at Laravel\Lumen\Application->handleFoundRoute()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:169)
  at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
     (/data/httpd/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:48)
  at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}()
     (/data/httpd/app/Http/Middleware/SetLocaleMiddleware.php:24)
  at App\Http\Middleware\SetLocaleMiddleware->handle()
     (/data/httpd/vendor/illuminate/pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/data/httpd/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30)
  at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}()
     (/data/httpd/vendor/illuminate/pipeline/Pipeline.php:103)
  at Illuminate\Pipeline\Pipeline->then()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:426)
  at Laravel\Lumen\Application->sendThroughPipeline()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:165)
  at Laravel\Lumen\Application->dispatch()
     (/data/httpd/app/AppKernel.php:73)
  at AppKernel->directDispatch()
     (/data/httpd/app/AppKernel.php:55)
  at AppKernel->{closure}()
     (/data/httpd/vendor/dingo/api/src/Http/Middleware/Request.php:111)
  at Dingo\Api\Http\Middleware\Request->handle()
     (/data/httpd/app/AppKernel.php:53)
  at AppKernel->dispatch()
     (/data/httpd/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:112)
  at Laravel\Lumen\Application->run()
     (/data/httpd/public/index.php:31)