Skip to content

Conversation

@morozov
Copy link

@morozov morozov commented Nov 29, 2017

According to http://php.net/manual/en/exception.gettrace.php#107563, the first entry doesn't contain the file/line keys since they are recorded in the exception object itself.

Additionally, some changes to the output formatting have been made:

  1. The trace entries are counted in a human-friendly way starting with "1" (like Xdebug does for example).
  2. The file name and line number in the "from" section are delimited by a colon without the space. This format is better IDE/editor friendly and helps easier navigation (e.g. Ctrl+N in PhpStorm, copy-paste the file:line combination).

With this patch applied, the output looks like the following:

↪ phpbrew --debug install 7.1.99
Exception: Version 7.1.99 not found.
Thrown from /home/morozov/Projects/phpbrew/src/PhpBrew/Command/InstallCommand.php at line 217:

  214            $version = preg_replace('/^php-/', '', $version);
  215            $versionInfo = $releaseList->getVersion($version);
  216            if (!$versionInfo) {
> 217                throw new \Exception("Version $version not found.");
  218            }
  219            $version = $versionInfo['version'];
  220
  221            $distUrlPolicy = new DistributionUrlPolicy();

Trace:

    1) PhpBrew\Command\InstallCommand->execute('7.1.99')

    2) call_user_func_array([PhpBrew\Command\InstallCommand, 'execute'], ['7.1.99'])
        from /home/morozov/Projects/phpbrew/vendor/corneltek/cliframework/src/CommandBase.php:846

    3) CLIFramework\CommandBase->executeWrapper(['7.1.99'])
        from /home/morozov/Projects/phpbrew/vendor/corneltek/cliframework/src/Application.php:398

    4) CLIFramework\Application->run(['bin/phpbrew', '--debug', 'install', '7.1.99'])
        from /home/morozov/Projects/phpbrew/src/PhpBrew/Console.php:114

    5) PhpBrew\Console->runWithTry(['bin/phpbrew', '--debug', 'install', '7.1.99'])
        from /home/morozov/Projects/phpbrew/bin/phpbrew:23

Fixes #108.

According to http://php.net/manual/en/exception.gettrace.php#107563, the first entry may not contain the file/line keys.

Additionally, some changes to the output formatting have been made:

1. The trace entries are counted in a human-friendly way starting with "1" (like Xdebug does for example).
2. The file name and line number in the "from" section are delimited by a colon without the space. This format is better IDE/editor friendly and helps easier navigation (e.g. Ctrl+N in PhpStorm, copy-paste the file:line combination).

Fixes #108.
@c9s
Copy link
Owner

c9s commented Feb 6, 2018

@morozov travis ci is failed, could you take a look?

@morozov
Copy link
Author

morozov commented Feb 6, 2018

@c9s there are issues with dependencies which I'm not going to fix:

  1. This package depends on corneltek/getoptionkit: ^2 but Enable custom validator on Option GetOptionKit#50 breaks compatibility with PHP 5.3 while still declares it supported.
  2. Restricting the version constraint for corneltek/getoptionkit to < 2.5.1 when the above issue was introduced causes:

Fatal error: Interface 'GetOptionKit\OptionPrinter\OptionPrinterInterface' not found in src/OptionPrinter.php on line 18

@c9s
Copy link
Owner

c9s commented Feb 8, 2018

Oh that’s too bad

@c9s c9s merged commit 2650a53 into c9s:3.0 Feb 8, 2018
@c9s
Copy link
Owner

c9s commented Feb 8, 2018

Let me merge this

@morozov morozov deleted the issues/108 branch February 7, 2019 21:46
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.

2 participants