Hi Ralph

I was about to ask the same thing, but your explanation makes complete sense.

Should we take this as another unofficial coding standard that these magic methods should all be protected (except __construct, of course, for where it needs to be public)?

The reason it was made protected was to prevent the masses from using the __get()/__set()/__isset()/__unset() methods directly, as that usage is frowned upon.. ie: $session->__get($name);

The reason is to protect from unintentional misuse.  As this scenario:

$session = new Zend_Session();
$var = array('foo'=>'bar');
$session->__set($var, 'value');

Would produce unexpected results.

-ralph

--

Simon Mundy | Director | PEPTOLAB

""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com


Reply via email to