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
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ PHP NEWS
. SessionHandler::validateId() is now implemented, so
session.use_strict_mode applies to the built-in handler. (Girgias)

- Sodium:
. Fixed incorrect parameter name in sodium_add(), sodium_memcmp(), and
sodium_compare() length-mismatch error messages. (lacatoire)

- Standard:
. Fixed incorrect parameter name in convert_uudecode() warning. (lacatoire)

- Zip:
. Fixed bug GH-17787 (ZipArchive stream stops reading early when the archive
is freed while the stream is still open). (Eyüp Can Akman)
Expand Down
4 changes: 2 additions & 2 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1482,10 +1482,10 @@ static zend_result php_session_send_cookie(void)
php_session_remove_cookie(); /* remove already sent session ID cookie */
/* 'replace' must be 0 here, else a previous Set-Cookie
header, probably sent with setcookie() will be replaced! */
sapi_add_header_ex(estrndup(ZSTR_VAL(ncookie.s), ZSTR_LEN(ncookie.s)), ZSTR_LEN(ncookie.s), false, false);
zend_result result = sapi_add_header_ex(estrndup(ZSTR_VAL(ncookie.s), ZSTR_LEN(ncookie.s)), ZSTR_LEN(ncookie.s), false, false);
smart_str_free(&ncookie);

return SUCCESS;
return result;
}

PHPAPI const ps_module *_php_find_ps_module(const char *name)
Expand Down
28 changes: 28 additions & 0 deletions ext/session/tests/session_start_cookie_header_rejected.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--TEST--
session_start() when the SAPI rejects the session cookie header
--INI--
session.save_handler=files
session.name=PHPSESSID
session.gc_probability=0
--EXTENSIONS--
session
--FILE--
<?php

ob_start();

set_error_handler(function (int $errno, string $errstr): bool {
echo "handler: ", $errstr, PHP_EOL;
return true;
});

session_set_cookie_params(['path' => "/\r\nX-Injected: yes"]);

var_dump(session_start());
var_dump(session_status() === PHP_SESSION_NONE);

?>
--EXPECT--
handler: Header may not contain more than a single header, new line detected
bool(false)
bool(true)
7 changes: 7 additions & 0 deletions ext/snmp/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ if test "$PHP_SNMP" != "no"; then
[AC_MSG_FAILURE([SNMP sanity check failed.])],
[$SNMP_SHARED_LIBADD])

dnl Check whether netsnmp_init_mib() exists.
PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [netsnmp_init_mib],
[AC_DEFINE([HAVE_NETSNMP_INIT_MIB], [1],
[Define to 1 if the Net-SNMP library has the 'netsnmp_init_mib' function.])],
[],
[$SNMP_SHARED_LIBADD])

dnl Check whether shutdown_snmp_logging() exists.
PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [shutdown_snmp_logging],
[AC_DEFINE([HAVE_SHUTDOWN_SNMP_LOGGING], [1],
Expand Down
8 changes: 8 additions & 0 deletions ext/snmp/snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,11 @@ PHP_FUNCTION(snmp_init_mib)

shutdown_mib();
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS, ZSTR_VAL(mibdirs));
#ifdef HAVE_NETSNMP_INIT_MIB
netsnmp_init_mib();
#else
init_mib();
#endif
}
/* }}} */

Expand Down Expand Up @@ -2228,7 +2232,11 @@ static PHP_RSHUTDOWN_FUNCTION(snmp)
if (mib_needs_reset) {
shutdown_mib();
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS, NULL);
#ifdef HAVE_NETSNMP_INIT_MIB
netsnmp_init_mib();
#else
init_mib();
#endif
}

return SUCCESS;
Expand Down