[doc-en] master: Document that ReflectionClass::setStaticPropertyValue ignores visibility (#5057)

From: Date: Sun, 30 Aug 2026 19:47:25 +0000
Subject: [doc-en] master: Document that ReflectionClass::setStaticPropertyValue ignores visibility (#5057)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23667@lists.php.net to get a copy of this message
Author: Louis-Arnaud (lacatoire) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-08-30T21:47:22+02:00 Commit: https://github.com/php/doc-en/commit/c74adac363c4ad18bfb648b8962663b26de3828b Raw diff: https://github.com/php/doc-en/commit/c74adac363c4ad18bfb648b8962663b26de3828b.diff Document that ReflectionClass::setStaticPropertyValue ignores visibility (#5057) The visibility check was dropped in php-src 26aefb750a (bug #69804), first released in 7.4.9 and also present in 8.0.0 and later. Drop the 7.4.0 changelog entry claiming a fatal error. In 7.4.0 as in 7.3, setting a private or protected static property threw a catchable ReflectionException: the Error raised by the visibility check is cleared by zend_clear_exception() before reflection throws its own exception. No behaviour changed in 7.4.0, and the entry contradicted the 7.4.9 one. Merge both rows into a single entry using the version cell convention for a fix released on two branches. Changed paths: M reference/reflection/reflectionclass/setstaticpropertyvalue.xml Diff: diff --git a/reference/reflection/reflectionclass/setstaticpropertyvalue.xml b/reference/reflection/reflectionclass/setstaticpropertyvalue.xml index 7c174a085360..16b212e072df 100644 --- a/reference/reflection/reflectionclass/setstaticpropertyvalue.xml +++ b/reference/reflection/reflectionclass/setstaticpropertyvalue.xml @@ -3,7 +3,7 @@ <refentry xml:id="reflectionclass.setstaticpropertyvalue" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>ReflectionClass::setStaticPropertyValue</refname> - <refpurpose>Sets public static property value</refpurpose> + <refpurpose>Sets static property value</refpurpose> </refnamediv> <refsect1 role="description"> @@ -14,12 +14,12 @@ <methodparam><type>mixed</type><parameter>value</parameter></methodparam> </methodsynopsis> <simpara> - Sets the value of a public static property. - If the property is private or protected, the method will fail. + Sets the value of a static property on this class, regardless of the + property's visibility. </simpara> <simpara> - <methodname>ReflectionProperty::setValue</methodname> allows setting - the value of public, private, and protected properties. + <methodname>ReflectionProperty::setValue</methodname> can also be + used to set the value of static properties. </simpara> </refsect1> @@ -66,11 +66,11 @@ </thead> <tbody> <row> - <entry>7.4.0</entry> + <entry>7.4.9, 8.0.0</entry> <entry> - Using <methodname>ReflectionClass::setStaticPropertyValue</methodname> to set - a private or protected property now results in a fatal error. Previously, it - threw a <classname>ReflectionException</classname>. + <methodname>ReflectionClass::setStaticPropertyValue</methodname> can now + set private and protected static properties. Previously, a + <exceptionname>ReflectionException</exceptionname> was thrown. </entry> </row> </tbody>

« previous php.doc.cvs (#23667) next »