Skip to content
Closed
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
10 changes: 10 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ PHP NEWS
. Fixed bug GH-23301 (Nested "yield from" yields a value twice when the
middle generator delegates again). (Lazizbek Ergashev)

- CLI:
. Fixed bug GH-23425 (sapi_cli_server_send_headers() does not check the
return value of php_cli_server_client_send_through()). (Lazizbek Ergashev)

- DOM:
. Fixed a use-after-free when cloning a DOMNameSpaceNode after
DOMDocument::xinclude(). (iliaal)
Expand All @@ -21,13 +25,17 @@ PHP NEWS
wrong argument in error messages. (Weilin Du)

- Intl:
. Fixed a memory leak when iterating IntlBreakIterator::getPartsIterator()
results. (iliaal)
. Fixed a double-free when IntlGregorianCalendar construction fails after
the ICU constructor adopts the TimeZone. (iliaal)
. Fixed bug GH-23094 (NumberFormatter parsing offsets use UTF-16 positions
for UTF-8 strings). (ColumbusLabs)
. Fixed Locale::parseLocale() reading past a trailing '-' or '_'.
(iliaal, Xuyang Zhang)
. Fixed grapheme_str_split() treating UBRK_DONE as a byte index. (iliaal)
. Fixed a leak in Locale::getKeywords() when a keyword value cannot be
read. (iliaal)

- Opcache:
. Fixed opcache.protect_memory race under ZTS. (realFlowControl)
Expand All @@ -46,6 +54,8 @@ PHP NEWS
an object converted to an array fails. (David Carlier)

- Zip:
. Fixed bug GH-23276 (ZipArchive subclass storing its own stream cannot be
garbage collected). (Weilin Du, ndossche)
. Fixed ZipArchive::extractTo() and ZipArchive::getFrom*() reporting success
on corrupted entries. (David Carlier)

Expand Down
2 changes: 1 addition & 1 deletion ext/intl/breakiterator/breakiterator_iterators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv,
ii->iterator->index = 0;

((zoi_with_current*)ii->iterator)->destroy_it = _breakiterator_parts_destroy_it;
ZVAL_OBJ_COPY(&((zoi_with_current*)ii->iterator)->wrapping_obj, Z_OBJ_P(object));
ZVAL_UNDEF(&((zoi_with_current*)ii->iterator)->wrapping_obj);
ZVAL_UNDEF(&((zoi_with_current*)ii->iterator)->current);

((zoi_break_iter_parts*)ii->iterator)->bio = Z_INTL_BREAKITERATOR_P(break_iter_zv);
Expand Down
1 change: 1 addition & 0 deletions ext/intl/common/common_enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void zoi_with_current_dtor(zend_object_iterator *iter)
zoi_with_current *zoiwc = (zoi_with_current*)iter;
zval_ptr_dtor(&zoiwc->wrapping_obj);
ZVAL_UNDEF(&zoiwc->wrapping_obj);
iter->funcs->invalidate_current(iter);
}

U_CFUNC zend_result zoi_with_current_valid(zend_object_iterator *iter)
Expand Down
1 change: 1 addition & 0 deletions ext/intl/locale/locale_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ PHP_FUNCTION( locale_get_keywords )
zend_string_efree( kw_value_str );
}
zend_array_destroy(Z_ARR_P(return_value));
uenum_close( e );
RETURN_FALSE;
}

Expand Down
23 changes: 23 additions & 0 deletions ext/intl/tests/breakiter_parts_iterator_current_leak.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
IntlPartsIterator must not retain the current element after destruction
--SKIPIF--
<?php if (!extension_loaded('intl')) die('skip intl extension not available'); ?>
--INI--
memory_limit=64M
--FILE--
<?php
$bi = IntlBreakIterator::createWordInstance('en');
$bi->setText('hello world foo bar baz');
$m0 = memory_get_usage();
for ($i = 0; $i < 300000; $i++) {
foreach ($bi->getPartsIterator() as $v) {
break;
}
}
$m1 = memory_get_usage();
var_dump($m1 - $m0 < 4 * 1024 * 1024);
?>

--EXPECT--
bool(true)

18 changes: 18 additions & 0 deletions ext/intl/tests/locale_get_keywords_failure.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Locale::getKeywords() closes the keyword enumeration on failure
--EXTENSIONS--
intl
--SKIPIF--
<?php
if (version_compare(INTL_ICU_VERSION, '59.1', '<')) {
die('skip for ICU >= 59.1');
}
?>
--FILE--
<?php
var_dump(Locale::getKeywords('en@foo=bar!'));
var_dump(intl_get_error_code() === U_ILLEGAL_ARGUMENT_ERROR);
?>
--EXPECT--
bool(false)
bool(true)
Loading
Loading