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

Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  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:32 +02:00
3 changed files with 22 additions and 1 deletions

4
NEWS
View File

@@ -16,6 +16,10 @@ PHP NEWS
- LibXML:
. Fixed bug GH-14563 (Build failure with libxml2 v2.13.0). (nielsdos)
- Output:
. Fixed bug GH-14808 (Unexpected null pointer in Zend/zend_string.h with
empty output buffer). (nielsdos)
- PDO:
. Fixed bug GH-14712 (Crash with PDORow access to null property).
(David Carlier)

View File

@@ -360,7 +360,11 @@ PHPAPI int php_output_get_level(void)
PHPAPI int 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) ""