8000 bug #33172 [Console] fixed a PHP notice when there is no function in … · symfony/symfony@08147dd · GitHub
[go: up one dir, main page]

Skip to content

Commit 08147dd

Browse files
bug #33172 [Console] fixed a PHP notice when there is no function in the stack trace of an Exception (fabpot)
This PR was merged into the 3.4 branch. Discussion ---------- [Console] fixed a PHP notice when there is no function in the stack trace of an Exception | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a Under certain circumstances, the `function` is not present in the stack trace. That's the case for instance when an error occurs on a line like this one `return require "somefile";`. Commits ------- ddb4735 [Console] fixed a PHP notice when there is no function
2 parents eb91f5f + ddb4735 commit 08147dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,11 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
809809
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
810810
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
811811
$type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
812-
$function = $trace[$i]['function'];
812+
$function = isset($trace[$i]['function']) ? $trace[$i]['function'] : '';
813813
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
814814
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
815815

816-
$output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
816+
$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
817817
}
818818

819819
$output->writeln('', OutputInterface::VERBOSITY_QUIET);

0 commit comments

Comments
 (0)
0