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

 ID:                 53992
 Updated by:         scott...@php.net
 Reported by:        msg2maciej at aol dot com
 Summary:            ambiguous property/method access
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            *General Issues
 Operating System:   MAC OSX
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

See previous comment.


Previous Comments:
------------------------------------------------------------------------
[2011-02-11 08:55:27] scott...@php.net

You're accessing hello() statically therefore there is no $this
context.



Add error_reporting(-1); to the top of your script and see all the
errors.

------------------------------------------------------------------------
[2011-02-11 07:23:01] msg2maciej at aol dot com

Description:
------------
I'm not sure if this is a bug. If you look in code why protected method
hello() can be accessed and property $this->var not, from that method?
PHP 5.3.3

Test script:
---------------
<?php

abstract class abstract_class { abstract protected function  hello(); }

class A extends abstract_class

{       private $B;     protected $var;

        function __construct () {

                $this->var = 'Undefined property??';

                $this->B = new B(__CLASS__);

        }

        protected function  hello()     {

                echo 'accessing '.__CLASS__.'::protected method - 
hello()'.PHP_EOL;

                echo $this->var;

}}

class B extends abstract_class

{       function __construct ( $class_A )

        {       $class_A::hello();      }

        protected function hello(){}

} new A; ?>

Expected result:
----------------
access $this->var , look into script.



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



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

Reply via email to