#34893 [Opn-Bgs]: PHP5.1 overloading, Cannot access private property

2005-10-19 Thread iliaa
 ID:   34893
 Updated by:   [EMAIL PROTECTED]
 Reported By:  kai at meder dot info
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: WinXP
 PHP Version:  5.1.0RC1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Do you even read documentation? Getters and Setters can only be used to
access properties that are not declared in the class.


Previous Comments:


[2005-10-19 12:53:22] kai at meder dot info

do you even read the bug-reports ?
by trying to set a private-property __get/__set are triggered in php5.1
(yes, it already works!) but there is a serious problem if using __get
AND __set together in a chain!



[2005-10-19 00:43:21] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

$a-p = $b; is the problem line, you are trying to access a private
property from outside the object, this is disallowed.



[2005-10-17 16:58:27] kai at meder dot info

Description:

chaining of objects using __get() works like a charm, however if using
chaining and using __set() at the end of the chain to set a property,
php fails reporting: Fatal error: Cannot access private property A::$p
in file on line line

please keep in mind that i'm using php5.1 (RC1), chaining should work
in this version, doesn't it?

posted reproduce code from
http://www.sitepoint.com/forums/showthread.php?p=2230679#post2230679


Reproduce code:
---
class A {
private $p;
function __get($name){
return $this-$name;
}
function __set($name, $value) {
$this-$name = $value;
}
}
class B {
private $t;
function __get($name){
return $this-$name;
}
function __set($name, $value) {
$this-$name = $value;
}
}
$a = new A;
$b = new B;
$a-p = $b;
$b-t = foo;

echo $a-p-t;
$a-p-t = bar;
echo $a-p-t;

Expected result:

foobar

Actual result:
--
foo
Fatal error: Cannot access private property A::$p in...





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


#34893 [Opn-Bgs]: PHP5.1 overloading, Cannot access private property

2005-10-19 Thread tony2001
 ID:   34893
 Updated by:   [EMAIL PROTECTED]
 Reported By:  kai at meder dot info
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: WinXP
 PHP Version:  5.1.0RC1
 New Comment:

You were talking to one of the core developers, so I don't see a reason
why you need another one to repeat the same.



Previous Comments:


[2005-10-19 20:30:41] kai at meder dot info

in php5.1 all betas and RC1 __get and __set are ALSO called when trying
to access protected/private (invisible) properties.

btw, the manual describes php5, not php5.1 which is in beta/rc-stadium
...

so please forward this *bug* to the overload-developers!



[2005-10-19 15:47:56] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Do you even read documentation? Getters and Setters can only be used to
access properties that are not declared in the class.



[2005-10-19 12:53:22] kai at meder dot info

do you even read the bug-reports ?
by trying to set a private-property __get/__set are triggered in php5.1
(yes, it already works!) but there is a serious problem if using __get
AND __set together in a chain!



[2005-10-19 00:43:21] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

$a-p = $b; is the problem line, you are trying to access a private
property from outside the object, this is disallowed.



[2005-10-17 16:58:27] kai at meder dot info

Description:

chaining of objects using __get() works like a charm, however if using
chaining and using __set() at the end of the chain to set a property,
php fails reporting: Fatal error: Cannot access private property A::$p
in file on line line

please keep in mind that i'm using php5.1 (RC1), chaining should work
in this version, doesn't it?

posted reproduce code from
http://www.sitepoint.com/forums/showthread.php?p=2230679#post2230679


Reproduce code:
---
class A {
private $p;
function __get($name){
return $this-$name;
}
function __set($name, $value) {
$this-$name = $value;
}
}
class B {
private $t;
function __get($name){
return $this-$name;
}
function __set($name, $value) {
$this-$name = $value;
}
}
$a = new A;
$b = new B;
$a-p = $b;
$b-t = foo;

echo $a-p-t;
$a-p-t = bar;
echo $a-p-t;

Expected result:

foobar

Actual result:
--
foo
Fatal error: Cannot access private property A::$p in...





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


#34893 [Opn-Bgs]: PHP5.1 overloading, Cannot access private property

2005-10-18 Thread iliaa
 ID:   34893
 Updated by:   [EMAIL PROTECTED]
 Reported By:  kai at meder dot info
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: WinXP
 PHP Version:  5.1.0RC1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

$a-p = $b; is the problem line, you are trying to access a private
property from outside the object, this is disallowed.


Previous Comments:


[2005-10-17 16:58:27] kai at meder dot info

Description:

chaining of objects using __get() works like a charm, however if using
chaining and using __set() at the end of the chain to set a property,
php fails reporting: Fatal error: Cannot access private property A::$p
in file on line line

please keep in mind that i'm using php5.1 (RC1), chaining should work
in this version, doesn't it?

posted reproduce code from
http://www.sitepoint.com/forums/showthread.php?p=2230679#post2230679


Reproduce code:
---
class A {
private $p;
function __get($name){
return $this-$name;
}
function __set($name, $value) {
$this-$name = $value;
}
}
class B {
private $t;
function __get($name){
return $this-$name;
}
function __set($name, $value) {
$this-$name = $value;
}
}
$a = new A;
$b = new B;
$a-p = $b;
$b-t = foo;

echo $a-p-t;
$a-p-t = bar;
echo $a-p-t;

Expected result:

foobar

Actual result:
--
foo
Fatal error: Cannot access private property A::$p in...





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