ID:               24735
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tater at potatoe dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Zend Engine 2 problem
 Operating System: OS X 10.2
 PHP Version:      5CVS-2003-07-21 (dev)
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




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

[2003-07-21 07:50:40] tater at potatoe dot com

Description:
------------
If I call a public function of a base class from a derived class
directly, the base class's function can use private properties of the
base class. If I call it via call_user_func() or
call_user_func_array(), it acts like an overloaded function of the
derived class, and doesn't see the private property (it ends up
creating a dynamic property for the object).

One or the other of these is wrong. I'm hoping it's the second one.

Reproduce code:
---------------
<?php
class foo
{
    private $a;
    private $b;
    public function set_a($v) { $this->a = $v; }
    public function set_b($v) { $this->b = $v; }
}
class bar extends foo { }
$f = new foo;
$f->set_a(1);
call_user_func(array($f,'set_b'), 2);
$b = new bar;
$b->set_a(1);
call_user_func(array($b,'set_b'), 2);
print_r($f);
print_r($b);
?>

Expected result:
----------------
foo Object
(
    [a:private] => 1
    [b:private] => 2
)
bar Object
(
    [a:private] => 1
    [b:private] => 2
)

Actual result:
--------------
foo Object
(
    [a:private] => 1
    [b:private] => 2
)
bar Object
(
    [a:private] => 1
    [b:private] =>
    [b] => 2
)


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


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

Reply via email to