Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Zend/zend_autoload.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
+----------------------------------------------------------------------+
*/

#ifndef _ZEND_AUTOLOAD_H
#define _ZEND_AUTOLOAD_H

#include "zend_string.h"
#include "zend_hash.h"
#include "zend_API.h"
Expand All @@ -28,3 +31,5 @@ ZEND_API void zend_autoload_fcc_map_to_callable_zval_map(zval *return_value);
/* Only for deprecated strange behaviour of spl_autoload_unregister() */
ZEND_API void zend_autoload_clean_class_loaders(void);
void zend_autoload_shutdown(void);

#endif
6 changes: 4 additions & 2 deletions Zend/zend_multiply.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si
: "=&r"(res), "=&r"(m_overflow)
: "r"(nmemb),
"r"(size),
"r"(offset));
"r"(offset)
: "cc");

if (UNEXPECTED(m_overflow)) {
*overflow = 1;
Expand All @@ -279,7 +280,8 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si
: "=&r"(res), "=&r"(m_overflow)
: "r"(nmemb),
"r"(size),
"r"(offset));
"r"(offset)
: "xer");

if (UNEXPECTED(m_overflow)) {
*overflow = 1;
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_pgsql/pgsql_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_
break;
#endif
#ifdef CONNECTION_GSS_STARTUP
case CONNECTION_SSL_STARTUP:
case CONNECTION_GSS_STARTUP:
ZVAL_STRINGL(return_value, "Negotiating GSSAPI.", strlen("Negotiating GSSAPI."));
break;
#endif
Expand Down
2 changes: 0 additions & 2 deletions ext/session/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ if test "$PHP_SESSION" != "no"; then
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])

PHP_ADD_EXTENSION_DEP(session, date)
dnl https://bugs.php.net/53141
PHP_ADD_EXTENSION_DEP(session, spl, true)

PHP_SUBST([SESSION_SHARED_LIBADD])
PHP_INSTALL_HEADERS([ext/session], [php_session.h mod_files.h mod_user.h])
Expand Down
2 changes: 0 additions & 2 deletions ext/session/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ ARG_ENABLE("session", "session support", "yes");
if (PHP_SESSION == "yes") {
EXTENSION("session", "mod_user_class.c session.c mod_files.c mod_user.c", false /* never shared */, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_EXTENSION_DEP('session', 'date');
// https://bugs.php.net/53141
ADD_EXTENSION_DEP('session', 'spl', true);
AC_DEFINE("HAVE_PHP_SESSION", 1, "Define to 1 if the PHP extension 'session' is available.");
PHP_INSTALL_HEADERS("ext/session", "php_session.h mod_files.h mod_user.h");
}
11 changes: 3 additions & 8 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,15 +1527,15 @@ static bool php_can_change_session_setting(const char *setting_name, bool check_

return false;
}

if (SG(headers_sent) && (!check_cookies || PS(use_cookies))) {
char error_msg[256];
snprintf(error_msg, sizeof(error_msg), "Session %s cannot be changed after headers have already been sent", setting_name);
php_session_headers_already_sent_error(E_WARNING, error_msg);

return false;
}

return true;
}

Expand Down Expand Up @@ -3055,11 +3055,6 @@ static PHP_MINFO_FUNCTION(session)
DISPLAY_INI_ENTRIES();
}

static const zend_module_dep session_deps[] = {
ZEND_MOD_OPTIONAL("spl")
ZEND_MOD_END
};

/* ************************
* Upload hook handling *
************************ */
Expand Down Expand Up @@ -3347,7 +3342,7 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
zend_module_entry session_module_entry = {
STANDARD_MODULE_HEADER_EX,
NULL,
session_deps,
NULL,
"session",
ext_functions,
PHP_MINIT(session), PHP_MSHUTDOWN(session),
Expand Down
21 changes: 21 additions & 0 deletions ext/standard/tests/general_functions/gh21018.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
GH-21018 (header() removes headers with the same prefix)
--INI--
expose_php=On
--CGI--
--FILE--
<?php
header('a: 1');
header('a-test: 1');
header('a: 1');
var_dump(headers_list());
?>
--EXPECTF--
array(3) {
[0]=>
string(%d) "X-Powered-By: PHP/%s"
[1]=>
string(9) "a-test: 1"
[2]=>
string(4) "a: 1"
}
11 changes: 8 additions & 3 deletions main/SAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ static void sapi_update_response_code(int ncode)
* since zend_llist_del_element only removes one matched item once,
* we should remove them manually
*/
static void sapi_remove_header(zend_llist *l, char *name, size_t len, size_t header_len)
static void sapi_remove_header(zend_llist *l, char *name, size_t len, size_t prefix_len)
{
sapi_header_struct *header;
zend_llist_element *next;
Expand All @@ -610,8 +610,13 @@ static void sapi_remove_header(zend_llist *l, char *name, size_t len, size_t hea
while (current) {
header = (sapi_header_struct *)(current->data);
next = current->next;
if (header->header_len > header_len
&& (header->header[header_len] == ':' || len > header_len)
/*
* prefix_len is set for DELETE_PREFIX (used for deleting i.e.
* "Set-Cookie: PHPSESSID=", where we need more than just key)
* look for the : otherwise
*/
if (header->header_len > len
&& (header->header[len] == ':' || (prefix_len && len > prefix_len))
&& !strncasecmp(header->header, name, len)) {
if (current->prev) {
current->prev->next = next;
Expand Down
Loading