ID:               22489
 User updated by:  marcot at tabini dot ca
 Reported By:      marcot at tabini dot ca
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Shouldn't matter
 PHP Version:      5CVS-2003-03-01 (dev)
 New Comment:

Okay, but even so I'm not assigning it the value `a::c'. So, even if
I'm creating a new property that hides the previous one, it should not
have any contents, no?


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

[2003-03-01 10:46:23] [EMAIL PROTECTED]

NO! & YES there is an error.

No: You are declaring a *new* dynamic property c in b
which hides c from a.

YES: there is a memory leak:
/usr/src/php4-HEAD/Zend/zend_language_scanner.l(1084) :  Freeing
0x40998D38 (7 bytes),
script=/usr/src/php4-HEAD/tests/classes/private_members.php

I'll have a look into it

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

[2003-03-01 10:36:25] marcot at tabini dot ca

Configure:

./configure \
--with-apxs=/usr/local/apache/bin/apxs

For example:

<?

class a
{
  private $c;

  function __construct()
  {
    $this->c = "a::c";
  }
}

class b
  extends a
{
  private $d;

  function _construct()
  {
    $this->d = 'b::d';
  }

  function test()
  {
    echo $this->c;
  }
}

$b = new b;

//echo $b->d;
$b->test();

?>

If executed, The first echo statement returns an error, as expected.
The $b->test() call, however, returns `a::c', which I think is
incorrect, as it should either not return anything or produce an error,
since a::$c is declared as private and should not be available to the b
namespace.


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


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

Reply via email to