[17.11.2006 01:48] Darby Felton wrote:
Without further supporting information (e.g., from contact with PHP
developers or from PHP development mailing list), however, I would
likely err on the side of caution where reasonable, making such
methods
public, rather than relying on a behavior that may conceivably be
changed in future PHP versions.
I agree that the magic methods should remain public.
If there is a change because of "strictness" I can imagine two
possibilities:
-> magic methods can't be called directly, making protected redundant
-> protected is always checked even when used as $class->var,
breaking our code
What we could do to avoid side effects is to always to always convert
a var name to string. It's already done by PHP with variable variables:
<?php
class Test {
function __set($var, $value) {
var_dump($var, $value);
}
}
$test = new Test();
$test->$test = 'value';
// -> string(6) "Object" string(5) "value"
?>
Then it wouldn't matter if the magic methods are called directly.
Speed wise it shouldn't make a difference - it's already done every-
time we don't call 'em directly.
nico