summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-12-01 12:48:58 +0100
committerAndrey Andreev <narf@devilix.net>2016-12-01 12:48:58 +0100
commite377910ccf826b448203513bf63bd5721bbd1375 (patch)
treee89a3e511563bb19e1afdc633ce29fd0cd959236
parent6276926c6dcdf976a5f4de34d62f501852e2f84b (diff)
Fix #4927
-rw-r--r--system/core/Output.php7
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 5 insertions, 3 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index cf6510ff1..57c78ab19 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -311,11 +311,12 @@ class CI_Output {
return NULL;
}
- for ($i = 0, $c = count($headers); $i < $c; $i++)
+ // Count backwards, in order to get the last matching header
+ for ($c = count($headers) - 1; $c > -1; $c--)
{
- if (strncasecmp($header, $headers[$i], $l = self::strlen($header)) === 0)
+ if (strncasecmp($header, $headers[$c], $l = self::strlen($header)) === 0)
{
- return trim(self::substr($headers[$i], $l+1));
+ return trim(self::substr($headers[$c], $l+1));
}
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index cb95d173b..0d8a93b54 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -23,6 +23,7 @@ Bug fixes for 3.1.3
- Fixed a bug (#4916) - :doc:`Session Library <libraries/sessions>` with ``sess_match_ip`` enabled was unusable for IPv6 clients when using the 'database' driver on MySQL 5.7.5+.
- Fixed a bug (#4917) - :doc:`Date Helper <helpers/date_helper>` function :php:func:`nice_date()` didn't handle YYYYMMDD inputs properly.
- Fixed a bug (#4923) - :doc:`Session Library <libraries/sessions>` could execute an erroneous SQL query with the 'database' driver, if the lock attempt times out.
+- Fixed a bug (#4927) - :doc:`Output Library <libraries/output>` method ``get_header()`` returned the first matching header, regardless of whether it would be replaced by a second ``set_header()`` call.
Version 3.1.2
=============