Skip to content

Disabled output handler is flushed again #15181

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
function test($vars) {
foreach ($vars as $i => $v1) {
foreach ($vars as $j => $v2) {
try {
$randomFunction = 'ob_flush';
$reflection = new ReflectionFunction($randomFunction);
$args = [];
$result[$randomFunction][] = $reflection->invokeArgs($args);
} catch (\Throwable $e) {
}
}
}
}
function var_fusion($var1, $var2, $var3) {
$vars = [$var1, $var2, $var3];
try{
test($vars);
} catch (ReflectionException $e) {
}
}
ob_start(function () {
throw new \Exception('ob_start');
});
var_fusion($x, $y, $z);

Resulted in this output:

/php-src/Zend/zend_string.h:200:24: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:44:28: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/Zend/zend_string.h:200:24

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions