1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
This commit is contained in:
Niels Dossche
2024-07-04 15:50:44 +02:00
2 changed files with 18 additions and 1 deletions

View File

@@ -359,7 +359,11 @@ PHPAPI int php_output_get_level(void)
PHPAPI zend_result php_output_get_contents(zval *p)
{
if (OG(active)) {
ZVAL_STRINGL(p, OG(active)->buffer.data, OG(active)->buffer.used);
if (OG(active)->buffer.used) {
ZVAL_STRINGL(p, OG(active)->buffer.data, OG(active)->buffer.used);
} else {
ZVAL_EMPTY_STRING(p);
}
return SUCCESS;
} else {
ZVAL_NULL(p);

13
tests/output/gh14808.phpt Normal file
View File

@@ -0,0 +1,13 @@
--TEST--
GH-14808 (Unexpected null pointer in Zend/zend_string.h with empty output buffer)
--FILE--
<?php
var_dump($args);
ob_start('ob_iconv_handler');
ob_clean();
var_dump(ob_get_contents());
?>
--EXPECTF--
Warning: Undefined variable $args in %s on line %d
NULL
string(0) ""