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
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ PHP NEWS
. Fixed bug GH-20217 (ReflectionClass::isIterable() incorrectly returns true
for classes with property hooks). (alexandre-daubois)
. Added ReflectionConstant::inNamespace(). (Khaled Alam)
. Added ReflectionProperty::isReadable() and ReflectionProperty::isWritable().
(ilutov)

- Session:
. Fixed bug 71162 (updateTimestamp never called when session data is empty).
Expand Down
4 changes: 2 additions & 2 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ PHP 8.6 UPGRADE NOTES

- Reflection:
. ReflectionConstant::inNamespace()
. ReflectionProperty::isReadable() ReflectionProperty::isWritable() were
added.
. Added ReflectionProperty::isReadable() and ReflectionProperty::isWritable().
RFC: https://wiki.php.net/rfc/isreadable-iswriteable

- Standard:
. `clamp()` returns the given value if in range, else return the nearest
Expand Down
10 changes: 0 additions & 10 deletions ext/pcre/tests/preg_match_all_negative_length_match.phpt

This file was deleted.

10 changes: 0 additions & 10 deletions ext/pcre/tests/preg_match_negative_length_match.phpt

This file was deleted.

15 changes: 12 additions & 3 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,10 @@ PHP_FUNCTION(highlight_file)
}

if (i) {
php_output_start_default();
if (UNEXPECTED(php_output_start_default() != SUCCESS)) {
zend_throw_error(NULL, "Unable to start output handler");
RETURN_THROWS();
}
}

php_get_highlight_struct(&syntax_highlighter_ini);
Expand Down Expand Up @@ -1780,7 +1783,10 @@ PHP_FUNCTION(php_strip_whitespace)
Z_PARAM_PATH_STR(filename)
ZEND_PARSE_PARAMETERS_END();

php_output_start_default();
if (UNEXPECTED(php_output_start_default() != SUCCESS)) {
zend_throw_error(NULL, "Unable to start output handler");
RETURN_THROWS();
}

zend_stream_init_filename_ex(&file_handle, filename);
zend_save_lexical_state(&original_lex_state);
Expand Down Expand Up @@ -1817,7 +1823,10 @@ PHP_FUNCTION(highlight_string)
ZEND_PARSE_PARAMETERS_END();

if (i) {
php_output_start_default();
if (UNEXPECTED(php_output_start_default() != SUCCESS)) {
zend_throw_error(NULL, "Unable to start output handler");
RETURN_THROWS();
}
}

EG(error_reporting) = E_ERROR;
Expand Down
25 changes: 25 additions & 0 deletions ext/standard/tests/strings/gh20906_1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
GH-20906 (Assertion failure when messing up output buffers) - php_strip_whitespace
--CREDITS--
vi3tL0u1s
--FILE--
<?php
class A {
function __destruct() {
php_strip_whitespace(__FILE__);
echo "x";
$c = new A;
ob_start(function () use ($c) { return '/'; }, 1);
ob_start(function () use (&$c) { $c = new A; return '/'; }, 1);
}
}

try {
new A;
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), "\n";
}
?>
--EXPECTF--
%a
Fatal error: php_strip_whitespace(): Cannot use output buffering in output buffering display handlers in %s on line %d
21 changes: 21 additions & 0 deletions ext/standard/tests/strings/gh20906_2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
GH-20906 (Assertion failure when messing up output buffers) - highlight_file
--CREDITS--
vi3tL0u1s
--FILE--
<?php
class A {
function __destruct() {
highlight_file(__FILE__, true);
echo "x";
$c = new A;
ob_start(function () use ($c) { return '/'; }, 1);
ob_start(function () use (&$c) { $c = new A; return '/'; }, 1);
}
}

new A;
?>
--EXPECTF--
%a
Fatal error: highlight_file(): Cannot use output buffering in output buffering display handlers in %s on line %d
21 changes: 21 additions & 0 deletions ext/standard/tests/strings/gh20906_3.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
GH-20906 (Assertion failure when messing up output buffers) - highlight_string
--CREDITS--
vi3tL0u1s
--FILE--
<?php
class A {
function __destruct() {
highlight_string(__FILE__, true);
echo "x";
$c = new A;
ob_start(function () use ($c) { return '/'; }, 1);
ob_start(function () use (&$c) { $c = new A; return '/'; }, 1);
}
}

new A;
?>
--EXPECTF--
%a
Fatal error: highlight_string(): Cannot use output buffering in output buffering display handlers in %s on line %d