8000 why by demeritcowboy · Pull Request #211 · civicrm/cv · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

why #211

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

Closed
wants to merge 1 commit into from
Closed

why #211

wants to merge 1 commit into from

Conversation

demeritcowboy
Copy link
Contributor

I'm curious about:

  • Whether the automated tests will show anything.
  • Why is this error handling needed.
    • I've previously had silent fails and needed to remove one or more of these to see the problem. Something similar recently came up in chat.

@@ -213,7 +213,7 @@ public function boot($options = array()) {

$this->log->debug("Load settings file \"" . $settings . "\"");
define('CIVICRM_SETTINGS_PATH', $settings);
$error = @include_once $settings;
$error = include_once $settings;
Copy link
Member

Choose a reason for hiding this comment

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

For this one, my guess: inertia

It's a little hard to see now, but Bootstrap.php arose from reorganizing/consolidating various copies of civicrm.config.php.XXX -- and some copies had suppression on this line. My guess is that someone felt dissatisfied that include_once didn't provide enough recoverability, and no one had the mix of incentive/time/expertise to question it.

But I share your view that this line probably isn't doing much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if (PHP_SAPI === "cli") {
error_reporting(1);
}

Copy link
Member

Choose a reason for hiding this comment

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

This is more likely to be doing something. Different CMS's are likely to switch error-reporting in different ways. (And if they have primary responsibility for processing the request, then power to them.) But from cv-cli pov, we just want access to their APIs -- and then the CLI UX should be consistent wrt to error-handling.

Looking at this again, I'm a little on the fence. Perhaps this value should be tuned-in more to the verbosity level...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On a live site, it's probably set to 1 to begin with. On a dev site, it's probably E_ALL. I'm not clear on why it can't just be left at whatever the surrounding environment has. But yes it could work to set error_reporting(1) here, but if you specify enough 'v's then skip setting it (and/or maybe force E_ALL with 3 v's?)

$result = $application->run();
ErrorHandler::popHandler();
Copy link
Member

Choose a reason for hiding this comment

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

I believe that this was a response to shifts in how "Symfony Console" approached error handling. Cv used symfony/console 2.x for a long time, and this wasn't needed. (Maybe 2.x had a more "batteries included" philosophy? Or just didn't have the bug) Somewhere around 3.x or 4.x, the default error-handling became... worse ("less opinionated"? "more vanilla"?)... e.g. it would exit(0) even if there was an error.

Of course, now we've switched to 5.x... maybe it's changed again...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I have had silence before this one existed, so it's probably not the biggest one, although there must be some error handler somewhere because normally @ doesn't silence fatals. But removing the @ is maybe the best bang for buck.

totten added a commit that referenced this pull request Sep 10, 2024
Trimmed down version of #211 - just remove the `@` suppression
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
0