Mantis - Quercus
Viewing Issue Advanced Details
585 minor always 12-27-05 15:41 08-25-08 11:27
creich  
ferg  
normal  
closed  
fixed  
none    
none 3.2.1  
0000585: private not hidden...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> [^]
<html xmlns="http://www.w3.org/1999/xhtml"> [^]
<head></head>
<body>
<?php

class ParentClass {
  function parentMethod() {
    echo "Hi Parent
";
  }
}

class ChildClass extends ParentClass{
  private $privateVar;
  public $publicVar;

  function childMethod() {
    echo "Hi Child
";
  }
}
$foo = new ChildClass();

$foo->parentMethod();
$foo->childMethod();

$foo->publicVar = "Goodbye";

echo $foo->publicVar."
";

$foo->privateVar = "Private";

echo $foo->privateVar."
";

ParentClass::parentMethod();

?>
</body>
</html>

Should output:

Hi Parent
Hi Child
Goodbye

Fatal error: Cannot access private property ChildClass::$privateVar...

Instead outputs:

Hi Parent
Hi Child
Goodbye
Private
Hi Parent

Notes
(0003352)
ferg   
08-25-08 11:27   
php/091k, php/391k