Bug #53992 [Opn->Bgs]: ambiguous property/method access
| From: | scottmac@php.net | Date: | Fri, 11 Feb 2011 07:56:18 +0000 |
| Subject: | Bug #53992 [Opn->Bgs]: ambiguous property/method access | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158700@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53992&edit=1
ID: 53992
Updated by: scottmac@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] scottmac@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