Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ PHP NEWS
(ilutov)
. Fixed bug GH-21362 (ReflectionMethod::invoke/invokeArgs() did not verify
Closure instance identity for Closure::__invoke()). (Ilia Alshanetsky)
. Added ReflectionParameter::getDocComment(). (chschneider)

- Session:
. Fixed bug 71162 (updateTimestamp never called when session data is empty).
Expand Down Expand Up @@ -141,6 +142,7 @@ PHP NEWS
. Fixed bug GH-13204 (glob() fails if square bracket is in current directory).
(ndossche)
. Add array size maximum to array_diff(). (ndossche)
. Add enum SortDirection. (timwolla)

- Streams:
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ PHP 8.6 UPGRADE NOTES
. ReflectionConstant::inNamespace()
. Added ReflectionProperty::isReadable() and ReflectionProperty::isWritable().
RFC: https://wiki.php.net/rfc/isreadable-iswriteable
. Added ReflectionParameter::getDocComment().
RFC: https://wiki.php.net/rfc/parameter-doccomments

- Intl:
. `grapheme_strrev()` returns strrev for grapheme cluster unit.
Expand All @@ -161,6 +163,10 @@ PHP 8.6 UPGRADE NOTES
7. New Classes and Interfaces
========================================

- Standard:
. enum SortDirection
RFC: https://wiki.php.net/rfc/sort_direction_enum

========================================
8. Removed Extensions and SAPIs
========================================
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -2997,6 +2997,7 @@ ZEND_API void zend_convert_internal_arg_info(zend_arg_info *new_arg_info, const
new_arg_info->name = NULL;
new_arg_info->default_value = NULL;
}
new_arg_info->doc_comment = NULL;
new_arg_info->type = arg_info->type;
zend_convert_internal_arg_info_type(&new_arg_info->type, persistent);
}
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -8027,6 +8027,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
} else {
arg_infos->type = (zend_type) ZEND_TYPE_INIT_CODE(fallback_return_type, 0, 0);
}
arg_infos->doc_comment = NULL;
arg_infos++;
op_array->fn_flags |= ZEND_ACC_HAS_RETURN_TYPE;

Expand Down Expand Up @@ -8125,6 +8126,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
arg_info->name = zend_string_copy(name);
arg_info->type = (zend_type) ZEND_TYPE_INIT_NONE(0);
arg_info->default_value = NULL;
arg_info->doc_comment = doc_comment_ast ? zend_string_copy(zend_ast_get_str(doc_comment_ast)) : NULL;

if (attributes_ast) {
zend_compile_attributes(
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ typedef struct _zend_arg_info {
zend_string *name;
zend_type type;
zend_string *default_value;
zend_string *doc_comment;
} zend_arg_info;

/* the following structure repeats the layout of zend_internal_arg_info,
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_language_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,9 @@ parameter:
{ $$ = zend_ast_create_ex(ZEND_AST_PARAM, $1 | $3 | $4, $2, $5, NULL,
NULL, $6 ? zend_ast_create_zval_from_str($6) : NULL, $7); }
| optional_cpp_modifiers optional_type_without_static
is_reference is_variadic T_VARIABLE backup_doc_comment '=' expr optional_property_hook_list
{ $$ = zend_ast_create_ex(ZEND_AST_PARAM, $1 | $3 | $4, $2, $5, $8,
NULL, $6 ? zend_ast_create_zval_from_str($6) : NULL, $9); }
is_reference is_variadic T_VARIABLE '=' expr backup_doc_comment optional_property_hook_list
{ $$ = zend_ast_create_ex(ZEND_AST_PARAM, $1 | $3 | $4, $2, $5, $7,
NULL, $8 ? zend_ast_create_zval_from_str($8) : NULL, $9); }
;

optional_type_without_static:
Expand Down
3 changes: 3 additions & 0 deletions Zend/zend_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,9 @@ ZEND_API void destroy_op_array(zend_op_array *op_array)
if (arg_info[i].name) {
zend_string_release_ex(arg_info[i].name, 0);
}
if (arg_info[i].doc_comment) {
zend_string_release_ex(arg_info[i].doc_comment, 0);
}
zend_type_release(arg_info[i].type, /* persistent */ false);
}
efree(arg_info);
Expand Down
3 changes: 3 additions & 0 deletions ext/opcache/zend_persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
zend_accel_store_interned_string(arg_info[i].name);
}
zend_persist_type(&arg_info[i].type);
if (arg_info[i].doc_comment) {
zend_accel_store_interned_string(arg_info[i].doc_comment);
}
}
if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
arg_info++;
Expand Down
3 changes: 3 additions & 0 deletions ext/opcache/zend_persist_calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array)
ADD_INTERNED_STRING(arg_info[i].name);
}
zend_persist_type_calc(&arg_info[i].type);
if (arg_info[i].doc_comment) {
ADD_INTERNED_STRING(arg_info[i].doc_comment);
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ void php_openssl_store_errors(void)
errors = OPENSSL_G(errors);

do {
errors->top = (errors->top + 1) % ERR_NUM_ERRORS;
errors->top = (errors->top + 1) % PHP_OPENSSL_ERR_BUFFER_SIZE;
if (errors->top == errors->bottom) {
errors->bottom = (errors->bottom + 1) % ERR_NUM_ERRORS;
errors->bottom = (errors->bottom + 1) % PHP_OPENSSL_ERR_BUFFER_SIZE;
}
errors->buffer[errors->top] = error_code;
} while ((error_code = ERR_get_error()));
Expand Down Expand Up @@ -4042,7 +4042,7 @@ PHP_FUNCTION(openssl_error_string)
RETURN_FALSE;
}

OPENSSL_G(errors)->bottom = (OPENSSL_G(errors)->bottom + 1) % ERR_NUM_ERRORS;
OPENSSL_G(errors)->bottom = (OPENSSL_G(errors)->bottom + 1) % PHP_OPENSSL_ERR_BUFFER_SIZE;
val = OPENSSL_G(errors)->buffer[OPENSSL_G(errors)->bottom];

if (val) {
Expand Down
4 changes: 3 additions & 1 deletion ext/openssl/php_openssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ extern zend_module_entry openssl_module_entry;
#define PHP_OPENSSL_API_VERSION 0x30200
#endif

#define PHP_OPENSSL_ERR_BUFFER_SIZE 16

#define OPENSSL_RAW_DATA 1
#define OPENSSL_ZERO_PADDING 2
#define OPENSSL_DONT_ZERO_PAD_KEY 4
Expand Down Expand Up @@ -65,7 +67,7 @@ extern zend_module_entry openssl_module_entry;
#endif

struct php_openssl_errors {
int buffer[ERR_NUM_ERRORS];
int buffer[PHP_OPENSSL_ERR_BUFFER_SIZE];
int top;
int bottom;
};
Expand Down
1 change: 1 addition & 0 deletions ext/pdo_pgsql/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if (PHP_PDO_PGSQL != "no") {
CHECK_HEADER("libpq-fe.h", "CFLAGS_PDO_PGSQL", PHP_PDO_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;")) {
EXTENSION("pdo_pgsql", "pdo_pgsql.c pgsql_driver.c pgsql_statement.c pgsql_sql_parser.c");

AC_DEFINE('HAVE_PG_RESULT_MEMORY_SIZE', 1, "Define to 1 if libpq has the 'PQresultMemorySize' function (PostgreSQL 12 or later).");
AC_DEFINE('HAVE_PDO_PGSQL', 1, "Define to 1 if the PHP extension 'pdo_pgsql' is available.");

ADD_EXTENSION_DEP('pdo_pgsql', 'pdo');
Expand Down
1 change: 1 addition & 0 deletions ext/pgsql/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if (PHP_PGSQL != "no") {
if (CHECK_LIB("libpq.lib", "pgsql", PHP_PGSQL) &&
CHECK_HEADER("libpq-fe.h", "CFLAGS_PGSQL", PHP_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;" + PHP_PGSQL)) {
EXTENSION("pgsql", "pgsql.c", PHP_PGSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_PG_RESULT_MEMORY_SIZE', 1, "Define to 1 if libpq has the 'PQresultMemorySize' function (PostgreSQL 12 or later).");
AC_DEFINE('HAVE_PGSQL', 1, "Define to 1 if the PHP extension 'pgsql' is available.");
ADD_FLAG("CFLAGS_PGSQL", "/D PGSQL_EXPORTS");
ADD_EXTENSION_DEP('pgsql', 'pcre');
Expand Down
16 changes: 16 additions & 0 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,22 @@ ZEND_METHOD(ReflectionParameter, __toString)

/* }}} */

/* {{{ Returns the doc comment for this parameter */
ZEND_METHOD(ReflectionParameter, getDocComment)
{
reflection_object *intern;
parameter_reference *param;

ZEND_PARSE_PARAMETERS_NONE();

GET_REFLECTION_OBJECT_PTR(param);
if (param->arg_info->doc_comment) {
RETURN_STR_COPY(param->arg_info->doc_comment);
}
RETURN_FALSE;
}
/* }}} */

/* {{{ Returns this parameter's name */
ZEND_METHOD(ReflectionParameter, getName)
{
Expand Down
2 changes: 2 additions & 0 deletions ext/reflection/php_reflection.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,8 @@ public function __construct($function, int|string $param) {}

public function __toString(): string {}

public function getDocComment(): string|false {}

/** @tentative-return-type */
public function getName(): string {}

Expand Down
12 changes: 8 additions & 4 deletions ext/reflection/php_reflection_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ext/reflection/php_reflection_decl.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ foreach ($classNames as $className) {
AssertionError
Directory
RoundingMode
SortDirection
StreamBucket
__PHP_Incomplete_Class
php_user_filter
Loading
Loading