Page MenuHomePhabricator

Incorrect calls of header () breaks saving some pages
Closed, ResolvedPublic

Description

MW 1.27, HHVM 3.14.3.

Warnings in /var/hhvm/error.log on every request:

\nWarning: header() expects parameter 3 to be integer, null given in /var/www/wiki/w/includes/WebResponse.php on line 42

Which is worse, this bug also breaks saving at least some of the pages. However, it is enough to replace

header( $string, $replace, $http_response_code );

with

if ($http_response_code) {
	header( $string, $replace, $http_response_code );
} else {
	header( $string, $replace );
}

in line 42 of includes/WebResponse.php (method WebResponse::header( $string, $replace = true, $http_response_code = null )) to fix it.

Event Timeline

alex-mashin triaged this task as Unbreak Now! priority.Jul 20 2016, 10:22 AM
alex-mashin added a project: HHVM.
alex-mashin updated the task description. (Show Details)
alex-mashin renamed this task from Type mismatches in error.log to Incorrect calls of header () .Jul 20 2016, 10:26 AM
alex-mashin updated the task description. (Show Details)
Aklapper renamed this task from Incorrect calls of header () to Incorrect calls of header () breaks saving some pages.Jul 20 2016, 11:42 AM
Aklapper lowered the priority of this task from Unbreak Now! to High.

No issue for me on master / HHVM 3.4.13.

Change 302430 had a related patch set uploaded (by Alexander I. Mashin):
Fix to incorrect calls of header () breaking saving some pages and login

https://gerrit.wikimedia.org/r/302430

No issue for me on master / HHVM 3.4.13.

This depends on the value of the [hhvm.php7.scalar_types](https://docs.hhvm.com/hhvm/configuration/INI-settings#php-7-settings) and hhvm.php7.all INI settings, according to a comment on HHVM Issue #6815. I was able to confirm that on a recent (one week old) development version of HHVM.

The underlying issue in HHVM is tracked as #7198.

matmarex assigned this task to alex-mashin.

Change 302430 merged by Bartosz Dziewoński:
Fix to incorrect calls of header () breaking saving some pages and login

https://gerrit.wikimedia.org/r/302430