[php-src] master: Merge branch 'PHP-8.6'

From: Date: Tue, 22 Sep 2026 21:10:09 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141452@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Date: 2026-09-22T14:09:08-07:00 Commit: https://github.com/php/php-src/commit/10a2b0dae015c155a0e1d7486989738c22493a02 Raw diff: https://github.com/php/php-src/commit/10a2b0dae015c155a0e1d7486989738c22493a02.diff Merge branch 'PHP-8.6' * PHP-8.6: Reflection: add UPGRADING note about changed boolean constant display Reflection: print boolean constant values as true and false Reflection: add regression tests for printing boolean constant values Changed paths: A ext/reflection/tests/ReflectionClassConstant_toString.phpt A ext/reflection/tests/ReflectionConstant_toString.phpt M Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt M ext/reflection/php_reflection.c M ext/reflection/tests/ReflectionClassConstant_basic1.phpt M ext/reflection/tests/bug29986.phpt M ext/reflection/tests/gh22681/ReflectionClassConstant_doc_comment.phpt M ext/reflection/tests/gh22681/ReflectionConstant_name.phpt M sapi/cli/tests/006.phpt Diff: diff --git a/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt b/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt index 43ff78e0720d..786b5245837b 100644 --- a/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt +++ b/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt @@ -265,7 +265,7 @@ array(2) { } Error: Attribute "Attribute" cannot target function (allowed targets: class) ******************** -Constant [ bool EXAMPLE ] { 1 } +Constant [ bool EXAMPLE ] { true } array(2) { [0]=> diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 370cfe86f952..8466cbcd27da 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -594,6 +594,10 @@ static void _const_string(smart_str *str, const zend_string *name, const zval *v smart_str_append(str, Z_STR_P(value)); } else if (Z_TYPE_P(value) == IS_DOUBLE) { smart_str_append_double(str, Z_DVAL_P(value), (int) EG(precision), false); + } else if (Z_TYPE_P(value) == IS_FALSE) { + smart_str_append(str, ZSTR_KNOWN(ZEND_STR_FALSE)); + } else if (Z_TYPE_P(value) == IS_TRUE) { + smart_str_append(str, ZSTR_KNOWN(ZEND_STR_TRUE)); } else { zend_string *tmp_value_str; zend_string *value_str = zval_get_tmp_string(value, &tmp_value_str); @@ -630,6 +634,10 @@ static void _class_const_string(smart_str *str, const zend_string *name, zend_cl smart_str_appends(str, "Object"); } else if (Z_TYPE(c->value) == IS_DOUBLE) { smart_str_append_double(str, Z_DVAL(c->value), (int) EG(precision), false); + } else if (Z_TYPE(c->value) == IS_FALSE) { + smart_str_append(str, ZSTR_KNOWN(ZEND_STR_FALSE)); + } else if (Z_TYPE(c->value) == IS_TRUE) { + smart_str_append(str, ZSTR_KNOWN(ZEND_STR_TRUE)); } else { zend_string *tmp_value_str; zend_string *value_str = zval_get_tmp_string(&c->value, &tmp_value_str); diff --git a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt index 4b8c8a32f785..cfe9bf4d8103 100644 --- a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt +++ b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt @@ -57,8 +57,8 @@ reflectClassConstant($instance, "BAD_CONST"); Reflecting on class constant TestClass::PUB __toString(): -string(57) "/** My Doc comment */ -Constant [ public bool PUB ] { 1 } +string(60) "/** My Doc comment */ +Constant [ public bool PUB ] { true } " getName(): string(3) "PUB" diff --git a/ext/reflection/tests/ReflectionClassConstant_toString.phpt b/ext/reflection/tests/ReflectionClassConstant_toString.phpt new file mode 100644 index 000000000000..83c513e8b42c --- /dev/null +++ b/ext/reflection/tests/ReflectionClassConstant_toString.phpt @@ -0,0 +1,39 @@ +--TEST-- +ReflectionClassConstant::__toString() and class constant display +--FILE-- +<?php + +class Demo { + public const IS_TRUE = true; + public const IS_FALSE = false; +} + +echo new ReflectionClassConstant(Demo::class, 'IS_TRUE'); +echo new ReflectionClassConstant(Demo::class, 'IS_FALSE'); + +echo new ReflectionClass(Demo::class); + +?> +--EXPECTF-- +Constant [ public bool IS_TRUE ] { true } +Constant [ public bool IS_FALSE ] { false } +Class [ <user> class Demo ] { + @@ %s %d-%d + + - Constants [2] { + Constant [ public bool IS_TRUE ] { true } + Constant [ public bool IS_FALSE ] { false } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [0] { + } +} diff --git a/ext/reflection/tests/ReflectionConstant_toString.phpt b/ext/reflection/tests/ReflectionConstant_toString.phpt new file mode 100644 index 000000000000..c60a8252d22b --- /dev/null +++ b/ext/reflection/tests/ReflectionConstant_toString.phpt @@ -0,0 +1,15 @@ +--TEST-- +ReflectionConstant::__toString() +--FILE-- +<?php + +const IS_TRUE = true; +const IS_FALSE = false; + +echo new ReflectionConstant('IS_TRUE'); +echo new ReflectionConstant('IS_FALSE'); + +?> +--EXPECT-- +Constant [ bool IS_TRUE ] { true } +Constant [ bool IS_FALSE ] { false } diff --git a/ext/reflection/tests/bug29986.phpt b/ext/reflection/tests/bug29986.phpt index 97aafd3820a0..865c66056761 100644 --- a/ext/reflection/tests/bug29986.phpt +++ b/ext/reflection/tests/bug29986.phpt @@ -20,7 +20,7 @@ Class [ <user> class just_constants ] { @@ %s %d-%d - Constants [5] { - Constant [ public bool BOOLEAN_CONSTANT ] { 1 } + Constant [ public bool BOOLEAN_CONSTANT ] { true } Constant [ public null NULL_CONSTANT ] { } Constant [ public string STRING_CONSTANT ] { This is a string } Constant [ public int INTEGER_CONSTANT ] { 1000 } diff --git a/ext/reflection/tests/gh22681/ReflectionClassConstant_doc_comment.phpt b/ext/reflection/tests/gh22681/ReflectionClassConstant_doc_comment.phpt index 5002f066ff69..2f64d37696bf 100644 --- a/ext/reflection/tests/gh22681/ReflectionClassConstant_doc_comment.phpt +++ b/ext/reflection/tests/gh22681/ReflectionClassConstant_doc_comment.phpt @@ -20,14 +20,14 @@ echo new ReflectionClass(Demo::class); ?> --EXPECTF-- /** F%0oo */ -Constant [ public bool DEMO ] { 1 } +Constant [ public bool DEMO ] { true } string(11) "/** F%0oo */" Class [ <user> class Demo ] { @@ %s(%d) : eval()'d code %d-%d - Constants [1] { /** F%0oo */ - Constant [ public bool DEMO ] { 1 } + Constant [ public bool DEMO ] { true } } - Static properties [0] { diff --git a/ext/reflection/tests/gh22681/ReflectionConstant_name.phpt b/ext/reflection/tests/gh22681/ReflectionConstant_name.phpt index c43397200c82..a9565ba988e6 100644 --- a/ext/reflection/tests/gh22681/ReflectionConstant_name.phpt +++ b/ext/reflection/tests/gh22681/ReflectionConstant_name.phpt @@ -11,5 +11,5 @@ var_dump( $r->getName() ); ?> --EXPECTF-- -Constant [ bool F%0oo ] { 1 } +Constant [ bool F%0oo ] { true } string(4) "F%0oo" diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt index 957543c1a28d..af9c8f8eb81e 100644 --- a/sapi/cli/tests/006.phpt +++ b/sapi/cli/tests/006.phpt @@ -63,7 +63,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] { Constant [ <persistent> string PCRE_VERSION ] { %s } Constant [ <persistent> int PCRE_VERSION_MAJOR ] { %d } Constant [ <persistent> int PCRE_VERSION_MINOR ] { %d } - Constant [ <persistent> bool PCRE_JIT_SUPPORT ] { %d } + Constant [ <persistent> bool PCRE_JIT_SUPPORT ] { %s } } - Functions {

« previous php.cvs (#141452) next »