mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Clear handler status flag in handler init
Closes GH-13087
This commit is contained in:
parent
6647d5f609
commit
3ce7bf2a77
5 changed files with 42 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -73,6 +73,9 @@ PHP NEWS
|
||||||
. Added X509_PURPOSE_OCSP_HELPER and X509_PURPOSE_TIMESTAMP_SIGN constants.
|
. Added X509_PURPOSE_OCSP_HELPER and X509_PURPOSE_TIMESTAMP_SIGN constants.
|
||||||
(Vincent Jardin)
|
(Vincent Jardin)
|
||||||
|
|
||||||
|
- Output:
|
||||||
|
. Clear output handler status flags during handler initialization. (haszi)
|
||||||
|
|
||||||
- PDO:
|
- PDO:
|
||||||
. Fixed setAttribute and getAttribute. (SakiTakamachi)
|
. Fixed setAttribute and getAttribute. (SakiTakamachi)
|
||||||
. Implemented PDO driver-specific subclasses RFC. (danack, kocsismate)
|
. Implemented PDO driver-specific subclasses RFC. (danack, kocsismate)
|
||||||
|
|
|
@ -313,6 +313,10 @@ PHP 8.4 UPGRADE NOTES
|
||||||
. New serial_hex parameter added to openssl_csr_sign to allow setting serial
|
. New serial_hex parameter added to openssl_csr_sign to allow setting serial
|
||||||
number in the hexadecimal format.
|
number in the hexadecimal format.
|
||||||
|
|
||||||
|
- Output:
|
||||||
|
. Output handler status flags passed to the flags parameter of ob_start
|
||||||
|
are now cleared.
|
||||||
|
|
||||||
- PDO:
|
- PDO:
|
||||||
. getAttribute, enabled to get the value of ATTR_STRINGIFY_FETCHES.
|
. getAttribute, enabled to get the value of ATTR_STRINGIFY_FETCHES.
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler,
|
||||||
default:
|
default:
|
||||||
user = ecalloc(1, sizeof(php_output_handler_user_func_t));
|
user = ecalloc(1, sizeof(php_output_handler_user_func_t));
|
||||||
if (SUCCESS == zend_fcall_info_init(output_handler, 0, &user->fci, &user->fcc, &handler_name, &error)) {
|
if (SUCCESS == zend_fcall_info_init(output_handler, 0, &user->fci, &user->fcc, &handler_name, &error)) {
|
||||||
handler = php_output_handler_init(handler_name, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_USER);
|
handler = php_output_handler_init(handler_name, chunk_size, PHP_OUTPUT_HANDLER_ABILITY_FLAGS(flags) | PHP_OUTPUT_HANDLER_USER);
|
||||||
ZVAL_COPY(&user->zoh, output_handler);
|
ZVAL_COPY(&user->zoh, output_handler);
|
||||||
handler->func.user = user;
|
handler->func.user = user;
|
||||||
} else {
|
} else {
|
||||||
|
@ -504,7 +504,7 @@ PHPAPI php_output_handler *php_output_handler_create_internal(const char *name,
|
||||||
php_output_handler *handler;
|
php_output_handler *handler;
|
||||||
zend_string *str = zend_string_init(name, name_len, 0);
|
zend_string *str = zend_string_init(name, name_len, 0);
|
||||||
|
|
||||||
handler = php_output_handler_init(str, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_INTERNAL);
|
handler = php_output_handler_init(str, chunk_size, PHP_OUTPUT_HANDLER_ABILITY_FLAGS(flags) | PHP_OUTPUT_HANDLER_INTERNAL);
|
||||||
handler->func.internal = output_handler;
|
handler->func.internal = output_handler;
|
||||||
zend_string_release_ex(str, 0);
|
zend_string_release_ex(str, 0);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#define PHP_OUTPUT_HANDLER_DISABLED 0x2000
|
#define PHP_OUTPUT_HANDLER_DISABLED 0x2000
|
||||||
#define PHP_OUTPUT_HANDLER_PROCESSED 0x4000
|
#define PHP_OUTPUT_HANDLER_PROCESSED 0x4000
|
||||||
|
|
||||||
|
#define PHP_OUTPUT_HANDLER_ABILITY_FLAGS(bitmask) ((bitmask) & ~0xf00f)
|
||||||
|
|
||||||
/* handler op return values */
|
/* handler op return values */
|
||||||
typedef enum _php_output_handler_status_t {
|
typedef enum _php_output_handler_status_t {
|
||||||
PHP_OUTPUT_HANDLER_FAILURE,
|
PHP_OUTPUT_HANDLER_FAILURE,
|
||||||
|
|
31
tests/output/ob_start_flags.phpt
Normal file
31
tests/output/ob_start_flags.phpt
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
--TEST--
|
||||||
|
ob_start(): Ensure that user supplied handler type and status flags are erased
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
define('PHP_OUTPUT_HANDLER_TYPE_INTERNAL', 0);
|
||||||
|
define('PHP_OUTPUT_HANDLER_TYPE_USER', 1);
|
||||||
|
|
||||||
|
ob_start(
|
||||||
|
fn ($s) => $s,
|
||||||
|
0,
|
||||||
|
PHP_OUTPUT_HANDLER_STDFLAGS |
|
||||||
|
PHP_OUTPUT_HANDLER_TYPE_INTERNAL |
|
||||||
|
PHP_OUTPUT_HANDLER_STARTED |
|
||||||
|
PHP_OUTPUT_HANDLER_DISABLED |
|
||||||
|
PHP_OUTPUT_HANDLER_PROCESSED
|
||||||
|
);
|
||||||
|
|
||||||
|
$bitmask = ob_get_status()['flags'];
|
||||||
|
|
||||||
|
var_dump($bitmask & PHP_OUTPUT_HANDLER_STDFLAGS);
|
||||||
|
var_dump($bitmask & PHP_OUTPUT_HANDLER_TYPE_USER);
|
||||||
|
var_dump($bitmask & PHP_OUTPUT_HANDLER_STARTED);
|
||||||
|
var_dump($bitmask & PHP_OUTPUT_HANDLER_DISABLED);
|
||||||
|
var_dump($bitmask & PHP_OUTPUT_HANDLER_PROCESSED);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
int(112)
|
||||||
|
int(1)
|
||||||
|
int(0)
|
||||||
|
int(0)
|
||||||
|
int(0)
|
Loading…
Add table
Add a link
Reference in a new issue