5
votes

I have been using qdPM v9.0 (from qdpm/core/apps/qdPM/config/app.yml) on Centos 6.7 server with PHP 7.0.6 and apache 2.2.x and MariaDB 5.5.x for over a year now without any issues. It seems to be using legacy Symfony 1.4.

I tried to install Let's Encrypt SSL certificates and this upgraded Apache/httpd to 2.2.15, no change in PHP or MariaDB versions.

Upon restarting httpd after SSL certificate installation, suddenly I get 500 Internal Server Error and the httpd error log shows:

...
[Wed Aug 09 14:55:22 2017] [error] [client x.x.x.x] Empty response header name, aborting request
[Wed Aug 09 14:55:32 2017] [error] [client x.x.x.x] Empty response header name, aborting request
...

Also, this is not a misconfiguration of SSL/Apache because other apps on other sub-domains continue work fine, both with and without Let's Encrypt SSL certificates.

Google does not help except some German discussion suggests to use PHP 5.3: https://www.php.de/forum/webentwicklung/php-frameworks/1508593-installation-symfony-framework

Symfony 1 geht nur mit maximal PHP 5.3... Deswegen sagte ich doch hol dir Symfony 3!!!

I cleared the cache several times. I removed all Let's Encrypt SSL configuration as well as restored old self-signed SSL certificates and restored Apache configuration to earlier working state.

And because we take backups daily, I even restored the entire code backup from a few hours before.

This should definitely have worked.

I still get the same error and no clue / hint as to how to debug it. Symfony logging documentation is for its current version, not for 1.4

What could have caused this issue?

How do I enable debugging so I could find where the error "Empty response header name" is being created so that maybe I can patch it?

3

3 Answers

13
votes

I modified the function and it works: (php 7.0+)

.../core/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 407

/** * Retrieves a normalized Header. * * @param string $name Header name * * @return string Normalized header */ protected function normalizeHeaderName($name) { $out = []; array_map(function($record) use (&$out) { $out[] = ucfirst(strtolower($record)); }, explode('-',$name)); return implode('-',$out); }

1
votes

This version works fine too:

  /**
   * Retrieves a normalized Header.
   *
   * @param  string $name  Header name
   *
   * @return string Normalized header
   */
  protected function normalizeHeaderName($name)
  {
    return preg_replace_callback('/\-(.)/', function ($matches) { return '-'.strtoupper($matches[1]); }, strtr(ucfirst(strtolower($name)), '_', '-'));
  }
0
votes

I was able to trace down the problem to the sent headers

core/lib/vendor/symfony/lib/response/sfWebResponse.class.php 
on line 357

something is wrong with the values.

qdPM 9.0 was running fine for over a year on PHP7, until an Apache 2 update for Ubuntu 16.04 was coming along.

However, I found the issue:

E_WARNING: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in 
.../core/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 409

but I do not get the old line:

return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", strtr(ucfirst(strtolower($name)), '_', '-'));

converted so that it will work. As far as I understand, it shall replace anything behind a dash with uppercase-letters. But I can't get it to work with preg_replace_callback:

return preg_replace_callback('\-(.)', function($m) { return '-'.strtoupper($m[1]); } , strtr(ucfirst(strtolower($name)), '_', '-'));

the anonymous function wont get called at all. I have removed the preg replace completely and now it is working fine. Maybe we will get an update here how to solve it correctly.