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 NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ PHP NEWS
. Deprecate specifying a nullable return type for __debugInfo(). (timwolla)
. Fixed bug GH-22142 (Assertion failure in zendi_try_get_long() on IS_UNDEF).
(David Carlier)
. Fixed bug GH-22046 (The unserialize function can lead to segfault when
non-Serializable internal classes are serialized back with the C format).
(kocsismate)

- BCMath:
. Added NUL-byte validation to BCMath functions. (jorgsowa)
Expand Down Expand Up @@ -70,6 +73,8 @@ PHP NEWS
- Intl:
. Fixed malformed ResourceBundle::get() error message when fallback is
disabled. (Weilin Du)
. Fixed IntlTimeZone::getDisplayName() to synchronize object error state
for invalid display types. (Weilin Du)
. Added IntlNumberRangeFormatter class to format an interval of two numbers
with a given skeleton, locale, collapse type and identity fallback.
(BogdanUngureanu)
Expand Down
2 changes: 2 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
. --with-pic is now --enable-pic. The old flag will result in an error.
. Symbol HAVE_ST_BLOCKS has been removed from php_config.h (use
HAVE_STRUCT_STAT_ST_BLOCKS).
. Added a new configure option --disable-apache2-conf to prevent apxs from
editing httpd.conf during installation.

- Windows build system changes:
. Function SETUP_OPENSSL() doesn't accept 6th argument anymore and doesn't
Expand Down
4 changes: 4 additions & 0 deletions ext/intl/tests/timezone_getDisplayName_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ intl
$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
var_dump($tz->getDisplayName(false, -1));
echo intl_get_error_message(), PHP_EOL;
var_dump($tz->getErrorCode());
echo $tz->getErrorMessage(), PHP_EOL;

?>
--EXPECT--
bool(false)
IntlTimeZone::getDisplayName(): wrong display type: U_ILLEGAL_ARGUMENT_ERROR
int(1)
IntlTimeZone::getDisplayName(): wrong display type: U_ILLEGAL_ARGUMENT_ERROR
7 changes: 4 additions & 3 deletions ext/intl/timezone/timezone_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,22 +483,23 @@ U_CFUNC PHP_FUNCTION(intltz_get_display_name)
RETURN_THROWS();
}

TIMEZONE_METHOD_FETCH_OBJECT;

bool found = false;
for (int i = 0; !found && i < sizeof(display_types)/sizeof(*display_types); i++) {
if (display_types[i] == display_type)
found = true;
}
if (!found) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "wrong display type");
intl_errors_set(TIMEZONE_ERROR_P(to), U_ILLEGAL_ARGUMENT_ERROR,
"wrong display type");
RETURN_FALSE;
}

if (!locale_str) {
locale_str = intl_locale_get_default();
}

TIMEZONE_METHOD_FETCH_OBJECT;

UnicodeString result;
to->utimezone->getDisplayName((UBool)daylight, (TimeZone::EDisplayType)display_type,
Locale::createFromName(locale_str), result);
Expand Down
17 changes: 8 additions & 9 deletions ext/standard/tests/serialize/serialization_objects_009.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ eval('class C {}');
$b = unserialize($ser);

var_dump($a, $b);

echo "Done";
?>
--EXPECTF--
Warning: Class __PHP_Incomplete_Class has no unserializer in %sserialization_objects_009.php on line %d
Warning: Class __PHP_Incomplete_Class has no unserializer in %s on line %d

Warning: unserialize(): Error at offset 11 of 18 bytes in %s on line %d

Warning: Class C has no unserializer in %s on line %d

Warning: Class C has no unserializer in %sserialization_objects_009.php on line %d
object(__PHP_Incomplete_Class)#%d (1) {
["__PHP_Incomplete_Class_Name"]=>
string(1) "C"
}
object(C)#%d (0) {
}
Warning: unserialize(): Error at offset 11 of 18 bytes in %s on line %d
bool(false)
bool(false)
Done
2 changes: 1 addition & 1 deletion ext/standard/var_unserializer.re
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)

if (ce->unserialize == NULL) {
zend_error(E_WARNING, "Class %s has no unserializer", ZSTR_VAL(ce->name));
object_init_ex(rval, ce);
return 0;
} else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash) != SUCCESS) {
return 0;
}
Expand Down
19 changes: 19 additions & 0 deletions ext/uri/tests/gh22046.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
GH-22046: The unserialize function can lead to segfault when internal classes are serialized back with the unsupported C format
--FILE--
<?php

$payload = 'C:14:"Uri\WhatWg\Url":0:{}';
unserialize($payload);

$payload = 'C:15:"Uri\Rfc3986\Uri":0:{}';
unserialize($payload);
?>
--EXPECTF--
Warning: Class Uri\WhatWg\Url has no unserializer in %s on line %d

Warning: unserialize(): Error at offset 25 of 26 bytes in %s on line %d

Warning: Class Uri\Rfc3986\Uri has no unserializer in %s on line %d

Warning: unserialize(): Error at offset 26 of 27 bytes in %s on line %d
11 changes: 10 additions & 1 deletion sapi/apache2handler/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ PHP_ARG_WITH([apxs2],
[no],
[no])

PHP_ARG_ENABLE([apache2-conf],
[whether to activate the PHP module in Apache httpd.conf via apxs],
[AS_HELP_STRING([--disable-apache2-conf],
[Do not activate the PHP module in the Apache httpd.conf during installation
via apxs. Useful when installing into a staging directory or when Apache
configuration is managed separately (e.g., via a2enmod).])],
[yes],
[no])

if test "$PHP_APXS2" != "no"; then
AS_VAR_IF([PHP_APXS2], [yes], [
APXS=apxs
Expand Down Expand Up @@ -69,7 +78,7 @@ if test "$PHP_APXS2" != "no"; then
[AC_MSG_ERROR([Please note that Apache version >= 2.4 is required])])

APXS_LIBEXECDIR='$(INSTALL_ROOT)'$($APXS -q LIBEXECDIR)
if test -z $($APXS -q SYSCONFDIR); then
if test -z $($APXS -q SYSCONFDIR) || test "$PHP_APACHE2_CONF" = "no"; then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-i -n php"
Expand Down
Loading