From 81f143e71f2293468859961f5d8faccb2a3d7244 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Mon, 24 Feb 2025 10:17:14 -0800 Subject: [PATCH 1/2] Reflection: indicate final and abstract properties in string output Add "final" and "abstract" to the result of `_property_string()` when outputting the string representation of a `ReflectionClass` or `ReflectionProperty` instance Closes GH-17827 --- NEWS | 2 + ext/reflection/php_reflection.c | 6 +++ .../tests/abstract_property_indicated.phpt | 42 +++++++++++++++++++ .../tests/asymmetric_visibility_flags.phpt | 2 +- .../tests/final_property_indicated.phpt | 42 +++++++++++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 ext/reflection/tests/abstract_property_indicated.phpt create mode 100644 ext/reflection/tests/final_property_indicated.phpt diff --git a/NEWS b/NEWS index ede93bdf11830..1968cb701e9bc 100644 --- a/NEWS +++ b/NEWS @@ -80,6 +80,8 @@ PHP NEWS - Reflection: . Fixed bug GH-15902 (Core dumped in ext/reflection/php_reflection.c). (DanielEScherzer) + . Fixed missing final and abstract flags when dumping properties. + (DanielEScherzer) - Standard: . Fixed bug #72666 (stat cache clearing inconsistent between file:// paths diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 15bc8c3f244d2..f79d8a5181dda 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -948,6 +948,12 @@ static void _property_string(smart_str *str, zend_property_info *prop, const cha if (!prop) { smart_str_append_printf(str, " public $%s", prop_name); } else { + if (prop->flags & ZEND_ACC_ABSTRACT) { + smart_str_appends(str, "abstract "); + } + if (prop->flags & ZEND_ACC_FINAL) { + smart_str_appends(str, "final "); + } /* These are mutually exclusive */ switch (prop->flags & ZEND_ACC_PPP_MASK) { case ZEND_ACC_PUBLIC: diff --git a/ext/reflection/tests/abstract_property_indicated.phpt b/ext/reflection/tests/abstract_property_indicated.phpt new file mode 100644 index 0000000000000..a70d88b7ece29 --- /dev/null +++ b/ext/reflection/tests/abstract_property_indicated.phpt @@ -0,0 +1,42 @@ +--TEST-- +Output of properties indicates if they are abstract +--FILE-- + +--EXPECTF-- +Class [ abstract class Demo ] { + @@ %s %d-%d + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [2] { + Property [ abstract public $a ] + Property [ public $b = NULL ] + } + + - Methods [0] { + } +} +Property [ abstract public $a ] +Property [ public $b = NULL ] diff --git a/ext/reflection/tests/asymmetric_visibility_flags.phpt b/ext/reflection/tests/asymmetric_visibility_flags.phpt index e6b171d3e765a..580404decda05 100644 --- a/ext/reflection/tests/asymmetric_visibility_flags.phpt +++ b/ext/reflection/tests/asymmetric_visibility_flags.phpt @@ -26,7 +26,7 @@ bool(true) bool(false) bool(true) bool(false) -Property [ public private(set) int $bar ] +Property [ final public private(set) int $bar ] bool(false) bool(true) bool(false) diff --git a/ext/reflection/tests/final_property_indicated.phpt b/ext/reflection/tests/final_property_indicated.phpt new file mode 100644 index 0000000000000..d4e159749a99a --- /dev/null +++ b/ext/reflection/tests/final_property_indicated.phpt @@ -0,0 +1,42 @@ +--TEST-- +Output of properties indicates if they are final +--FILE-- + +--EXPECTF-- +Class [ class Demo ] { + @@ %s %d-%d + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [2] { + Property [ final public $a = NULL ] + Property [ public $b = NULL ] + } + + - Methods [0] { + } +} +Property [ final public $a = NULL ] +Property [ public $b = NULL ] From 1ec469d11630772423cfe944ca89867a7c6be54a Mon Sep 17 00:00:00 2001 From: Saki Takamachi Date: Wed, 26 Feb 2025 00:02:20 +0900 Subject: [PATCH 2/2] PHP-8.4 is now for PHP 8.4.6-dev --- NEWS | 5 ++++- Zend/zend.h | 2 +- configure.ac | 2 +- main/php_version.h | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 1968cb701e9bc..23ad1ae72a8aa 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 8.4.5 +?? ??? ????, PHP 8.4.6 + + +27 Feb 2025, PHP 8.4.5 - BCMath: . Fixed bug GH-17398 (bcmul memory leak). (SakiTakamachi) diff --git a/Zend/zend.h b/Zend/zend.h index 79b4b468d7409..c787b54940d92 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -20,7 +20,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "4.4.5-dev" +#define ZEND_VERSION "4.4.6-dev" #define ZEND_ENGINE_3 diff --git a/configure.ac b/configure.ac index 6e06e6e799541..63a30a9def502 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice. dnl ---------------------------------------------------------------------------- AC_PREREQ([2.68]) -AC_INIT([PHP],[8.4.5-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net]) +AC_INIT([PHP],[8.4.6-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net]) AC_CONFIG_SRCDIR([main/php_version.h]) AC_CONFIG_AUX_DIR([build]) AC_PRESERVE_HELP_ORDER diff --git a/main/php_version.h b/main/php_version.h index 2f3f61ddbf1e0..e46868a3abd88 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.ac to change version number */ #define PHP_MAJOR_VERSION 8 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 5 +#define PHP_RELEASE_VERSION 6 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "8.4.5-dev" -#define PHP_VERSION_ID 80405 +#define PHP_VERSION "8.4.6-dev" +#define PHP_VERSION_ID 80406