Req #62510 [Opn->Sus]: Some suggestions for static variables inside functions and methods

From: Date: Tue, 06 Apr 2021 14:14:16 +0000
Subject: Req #62510 [Opn->Sus]: Some suggestions for static variables inside functions and methods
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233222@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62510&edit=1

 ID:                 62510
 Updated by:         cmb@php.net
 Reported by:        dev at pp3345 dot de
 Summary:            Some suggestions for static variables inside
                     functions and methods
-Status:             Open
+Status:             Suspended
 Type:               Feature/Change Request
 Package:            Reflection related
 PHP Version:        5.4.4
 Block user comment: N
 Private report:     N

 New Comment:

While I think adding these methods makes sense, this is clearly
something that requires an RFC.  So if you, or anybody else for
that matter, is still interested in having these methods, please
pursue the RFC process[1].  For the time being, I suspend this
ticket.

Please note that uopz_set_static()[2] already allows to change the
value of function statics.

[1] <https://wiki.php.net/rfc/howto>
[2] <https://www.php.net/manual/en/function.uopz-set-static.php>


Previous Comments:
------------------------------------------------------------------------
[2012-07-08 18:06:36] dev at pp3345 dot de

Description:
------------
With Reflection, it is possible to get and set static properties in classes, 
even 
when they are private or protected. This should also be possible for static 
variables inside functions and methods. There is a method 
ReflectionFunctionAbstract::getStaticVariables() that returns the names and 
values 
of static variables inside the function. In my opinion, there should also be a 
function ReflectionFunctionAbstract::setStaticVariable(). 

I'd also like to mention this bug: https://bugs.php.net/bug.php?id=51581 - It 
was 
declined about two years ago but I think it should be fixed. I suggested in a 
comment that a solution for the increased memory usage could be a ini-setting 
(like "reflection.track_static_properties") that enables (should probably be 
disabled by default) the tracking of the default values of static properties. If 
this could be done, I also suggest adding a similar function to retrieve the 
default values of static variables in functions, for example 
ReflectionFunctionAbstract::getDefaultStaticVariables().



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=62510&edit=1


Thread (2 messages)

« previous php.bugs (#233222) next »