Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  XFAIL tests (GH-8588)
  Stop closing stderr and stdout streams (#8569)
This commit is contained in:
Arnaud Le Blanc 2022-05-20 13:32:29 +02:00
commit 6465f3ed13
7 changed files with 35 additions and 6 deletions

View File

@ -11,6 +11,8 @@ opcache
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--XFAIL--
GH-8588
--FILE--
<?php
var_dump(get_class(Loader::getLoader()));

View File

@ -11,6 +11,8 @@ opcache
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--XFAIL--
GH-8588
--FILE--
<?php
const CNST = 'bbbb';

View File

@ -11,6 +11,8 @@ opcache
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--XFAIL--
GH-8588
--FILE--
<?php
Foo::test();

View File

@ -11,6 +11,8 @@ opcache
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--XFAIL--
GH-8588
--FILE--
<?php
$bar = new Bar;

View File

@ -460,6 +460,7 @@ static ZEND_METHOD(ZendTestChildClassWithMethodWithParameterAttribute, override)
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("zend_test.replace_zend_execute_ex", "0", PHP_INI_SYSTEM, OnUpdateBool, replace_zend_execute_ex, zend_zend_test_globals, zend_test_globals)
STD_PHP_INI_BOOLEAN("zend_test.register_passes", "0", PHP_INI_SYSTEM, OnUpdateBool, register_passes, zend_zend_test_globals, zend_test_globals)
STD_PHP_INI_BOOLEAN("zend_test.print_stderr_mshutdown", "0", PHP_INI_SYSTEM, OnUpdateBool, print_stderr_mshutdown, zend_zend_test_globals, zend_test_globals)
PHP_INI_END()
void (*old_zend_execute_ex)(zend_execute_data *execute_data);
@ -585,6 +586,10 @@ PHP_MSHUTDOWN_FUNCTION(zend_test)
zend_test_observer_shutdown(SHUTDOWN_FUNC_ARGS_PASSTHRU);
if (ZT_G(print_stderr_mshutdown)) {
fprintf(stderr, "[zend-test] MSHUTDOWN\n");
}
return SUCCESS;
}

View File

@ -0,0 +1,14 @@
--TEST--
CLI: stderr is available in mshutdown
--SKIPIF--
<?php
if (!extension_loaded('zend-test')) die('skip zend-test extension required');
if (php_sapi_name() != "cli") die('skip cli test only');
?>
--INI--
zend_test.print_stderr_mshutdown=1
--FILE--
==DONE==
--EXPECTF--
==DONE==
[zend-test] MSHUTDOWN

View File

@ -538,6 +538,14 @@ static void cli_register_file_handles(bool no_close) /* {{{ */
s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out);
s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err);
/* Release stream resources, but don't free the underlying handles. Othewrise,
* extensions which write to stderr or company during mshutdown/gshutdown
* won't have the expected functionality.
*/
if (s_in) s_in->flags |= PHP_STREAM_FLAG_NO_CLOSE;
if (s_out) s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
if (s_err) s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;
if (s_in==NULL || s_out==NULL || s_err==NULL) {
if (s_in) php_stream_close(s_in);
if (s_out) php_stream_close(s_out);
@ -545,12 +553,6 @@ static void cli_register_file_handles(bool no_close) /* {{{ */
return;
}
if (no_close) {
s_in->flags |= PHP_STREAM_FLAG_NO_CLOSE;
s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;
}
s_in_process = s_in;
php_stream_to_zval(s_in, &ic.value);