Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #36707 : $this visibility violated
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 24th May 13:43
php-bugs
External User
 
Posts: 1
Default #36707 : $this visibility violated


ID: 36707
User updated by: andreigurin at tiscali dot it
Reported By: andreigurin at tiscali dot it
Status: Bogus
Bug Type: Class/Object related
Operating System: windows xp sp2 / linux centos /
PHP Version: 4.4.2
New Comment:

Are there a piece of do***entation describing this behavior? Thanks for
reply!


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

[2006-03-13 10:37:58] tony2001@php.net

This is expected and it was done in order to keep compatibility with
4.x.

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

[2006-03-13 10:34:12] andreigurin at tiscali dot it

ok, try this

<?php

error_reporting(E_ALL);

class Foo {
protected $__prv;

public function Foo($v) {
$this->__prv = $v;
}

public function prv() {
return $this->__prv;
}

function tst() {
Bar::babar();
}
}

class Bar {

public function babar() {
print $this->prv();
}
}

$foo = new Foo('PRV VALUE');
$foo->tst();

?>

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

[2006-03-13 09:19:01] tony2001@php.net

Works fine both with 4.x and 5.x.
No bug here.

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

[2006-03-13 09:18:28] andreigurin at tiscali dot it

Look here: This happens in 4.*** versions, and in 5.***, my code is for
version 5.
I reported the first version i tested it. It equally falls on 4 an on
5.

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

[2006-03-13 09:13:11] judas dot iscariote at gmail dot com

your test results :

Fatal error: Using $this when not in object context..

and the code you mention cannot run in PHP4, since PHP doesn't have
public, private modifiers...

what are you talking about ?

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

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/36707

--
Edit this bug report at http://bugs.php.net/?id=36707&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666