File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug29674.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 10 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Bug #29674 (inherited method doesn't have access to private variables of the derived class)
    3: --FILE--
    4: <?php
    5: 
    6: class BaseClass
    7: {
    8: 	private $private_base = "Base";
    9: 	
   10: 	function printVars ()
   11: 	{
   12: 		var_dump($this->private_base);
   13: 		var_dump($this->private_child);
   14: 	}
   15: }
   16: 
   17: class ChildClass extends BaseClass
   18: {
   19: 	private $private_child = "Child";
   20: }
   21: 
   22: echo "===BASE===\n";
   23: $obj = new BaseClass;
   24: $obj->printVars();
   25: 
   26: echo "===CHILD===\n";
   27: $obj = new ChildClass;
   28: $obj->printVars();
   29: 
   30: ?>
   31: ===DONE===
   32: --EXPECTF--
   33: ===BASE===
   34: string(4) "Base"
   35: 
   36: Notice: Undefined property: BaseClass::$private_child in %sbug29674.php on line %d
   37: NULL
   38: ===CHILD===
   39: string(4) "Base"
   40: 
   41: Fatal error: Cannot access private property ChildClass::$private_child in %sbug29674.php on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>