php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40159 Cannot access protected property
Submitted: 2007-01-18 11:20 UTC Modified: 2007-02-22 10:50 UTC
From: dominik dot bulaj at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.0 OS: Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dominik dot bulaj at gmail dot com
New email:
PHP Version: OS:

 

 [2007-01-18 11:20 UTC] dominik dot bulaj at gmail dot com
Description:
------------
I got 3 classes:

abstract class BlogApi
{
    protected $blogUrl  = false;
    // other properties

    public function setup($blogUrl, $username, $password, $blogId = 1)
    {
        $this->blogUrl  = $blogUrl;
        $this->username = $username;
        $this->password = $password;
        $this->blogId   = $blogId;
        
        return $this;
    }
    // rest of methods
}

abstract class BloggerApi extends BlogApi
{
    // some methods specyfic for BloggerApi
    
}

class WordPress extends BloggerApi
{
    // some methods
    public function publish()
    {
        return $this->publishToBlog(rtrim($this->blogUrl, '/').'/xmlrpc.php');
    }
}


Now when I start with:

$wp = new WordPress;
$wp->setup('some_url', 'usr_name', 'pwd', 1);
// another method to set-up post subject & body
$wp->publish();

I got error:

Fatal error: Cannot access protected property WordPress::$blogUrl in ....

Strange is, that code worked well in PHP 5.1.6-5 on Debian.

Actual result:
--------------
Fatal error: Cannot access protected property WordPress::$blogUrl in ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-18 11:22 UTC] tony2001@php.net
Cannot reproduce.
 [2007-01-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-02-22 06:16 UTC] bugs dot php at mobocracy dot net
I am getting a similar issue with PHP 5.2.1, Linux, with eAccelerator. I have two classes like:

class Foo {
    protected $item;
    function __construct()
    {
        $this->item = 'Foo';
    }
}
class Bar extends Foo {}

When I do:

$c = new Bar();

I get the same fatal error as described in the original report. When I disable eaccelerator, this goes away. I will submit a bug to eaccelerator.
 [2007-02-22 06:21 UTC] bugs dot php at mobocracy dot net
BTW, this appears to be fixed with eaccelerator svn snapshot 301.

-Blake
 [2007-02-22 10:50 UTC] tony2001@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 10:01:32 2024 UTC