Process failed? BC and use cases for property_exists() broken in PHP 5.3
| From: | Stan Vass | Date: | Tue, 12 Oct 2010 12:53:08 +0000 |
| Subject: | Process failed? BC and use cases for property_exists() broken in PHP 5.3 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-49901@lists.php.net to get a copy of this message | ||
I think this is a great case study that could lead to some improvements in the process of fixing
bugs in PHP:
http://bugs.php.net/bug.php?id=45743
A potential bug was reported on property_exists() that it won't report inaccessible properties
in the scope.
The problem is this was, in fact, the intended behavior, and despite everything saying the function
works correctly, everything around it was changed in order to agree with the new behavior for no
good reason that I can see:
1) A test existed that specifically tested propert_exists() respects visibility of the property from
the call scope. So for this 'bugfix' to pass tests, the *test was simply changed*.
2) The documentation specifically said the function respects visibility of the property, so for this
'bugfix' to agree with documentation, the *documentation was changed*.
3) The use case for this function required the existing behavior (i.e. can you safely call property
$x from the current scope with no warning?), and that *ignored* when the behavior was changed. We
already have Reflection classes for inquiring protected/private properties of a class from any
scope.
So, what happened here?
Stan Vass