Why does SERVER_SIGNATURE header error not show up in any log on my system?

The header error with zendframework/zend-diactoros:2.0.2 when SERVER_SIGNATURE header is set is shown to me via triggering the error template of Zend Expressive. However, error template is generic and does not tell me what the actual error is, other than it is an HTTP 500 error.

The descriptive detailed error itself is not showing up…

  • Not in my Apache log
  • Not inside browser screen
  • Not in Mozilla Developer tools when looking at Request/Response headers/body
  • Not inside the error log set up inside my samsonasik/ErrorHeroModule
  • Not via Whoops

It’s a ghosted error …

Somehow Expressive eats this error completely and only indicates it by throwing the generic 500 error template on my system. Is there a way to set up Expressive to show this error more descriptively somewhere ?

In my pipeline.php I have this:

    $app->pipe(ErrorHandler::class);
    $app->pipe(ErrorHeroModule\Middleware\Expressive::class);

and I have Whoops factories defined in my development.local.php

Am I possibly missing anything? Should I check any particular configuration?

You are not running by chance a “generic” PHP 7.2 (Debian) docker image?
If yes, looks like I have the exact same problem. It just dies without any explanation…

If not, is there any interaction with SERVER_SIGNATURE in your code or is it just enabled within apache?

This is probably related to a bug in version 2.0.2 and 2.1.0. A fix is available here: https://github.com/zendframework/zend-diactoros/pull/349

However we are waiting for someone to be able to merge to hotfix :frowning:

In the meantime you can use this "zendframework/zend-diactoros": "^2.0 !=2.0.2 !=2.1.0" in composer.json so it will skip the affected version and install patched versions when available.

This does not solve the problem which @dennis-fedco means: no error reporting!
I think the problem of error reporting should also be reported and fixed – additionally. (Btw. the description of the problem is contained internally in an exception, but is not output.)

AFAIK this is a chicken egg story. You cannot have proper error reporting because in zend-expressive the exceptions are caught after the error handler middleware is started. The exception happens before that where the needed services are not yet operational. This has been discussed a few times on Slack. The only way to catch this is if you have functional tests for this or wrap the whole application in a second error handler.

In my opinion it should throw an exception and halt the system at that point, or at least in debug mode. It would have saved me a few hours debugging this a few days ago.

1 Like