ID:               24808
 Updated by:       [EMAIL PROTECTED]
 Reported By:      Bertrand dot Willm at laposte dot net
-Status:           Analyzed
+Status:           Closed
 Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5*
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Reproduce code now returns "default" as expected.

--- Test script --
<?php
  class Foo {
    private $private_member = 'private';
    protected $protected_member = 'protected';
    public $public_member= 'public';
    
    function __get($name) {
      return $this->{$name}.' (via __get)';
    }
  }
  
  $foo= new Foo();
  var_dump($foo->private_member);
  var_dump($foo->protected_member);
  var_dump($foo->public_member);
?>

--- Output --
string(19) "private (via __get)"
string(21) "protected (via __get)"
string(6) "public"



Previous Comments:
------------------------------------------------------------------------

[2004-07-13 16:16:50] de_bruut at hotmail dot com

Quick suggestion:

Please consider adding the same overloading functionality (  __call() )
for private and protected methods.

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

[2004-05-31 23:14:28] [EMAIL PROTECTED]

That seems to be the best solution.

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

[2004-05-30 14:43:07] [EMAIL PROTECTED]

After talking with Andi, I think it's a valid issue and what needs to
be done is to make accessors (__get/__set) be called on access to
variables that are not visible in current context. This still would not
change the fact that acessors are not called on existing variables, but
invisible variables in this context would be regarded as good as
unexisting.

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

[2003-10-16 05:03:46] [EMAIL PROTECTED]

The behavior is absolut correct. Since the property 'var' is declared
private it cannot be accessed. And also since it is a declared property
there is no need for the engine to execute __call(). Both __get() and
__set() are only there to handle virtual properties (aka not declared
ones).

Double check #25815 and #25199

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

[2003-07-28 18:50:06] alan at akbkhome dot com

This has been discussed on zend2-engine, getters and setters on
'defined' vars is a feature that a number of people would like to
see..

AFAIK It just needs a voluteer to propose some code..

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/24808

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

Reply via email to