File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / lang / bug21961.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 4 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 #21961 (get_parent_class() segfault)
    3: --SKIPIF--
    4: <?php if (version_compare(zend_version(),'2.0.0-dev','<')) die('skip prepared for ZE2'); ?>
    5: --FILE--
    6: <?php
    7: 
    8: class man
    9: {
   10: 	public $name, $bars;
   11: 	function man()
   12: 	{
   13: 		$this->name = 'Mr. X';
   14: 		$this->bars = array();
   15: 	}
   16: 
   17: 	function getdrunk($where)
   18: 	{
   19: 		$this->bars[] = new bar($where);
   20: 	}
   21: 
   22: 	function getName()
   23: 	{
   24: 		return $this->name;
   25: 	}
   26: }
   27: 
   28: class bar extends man
   29: {
   30: 	public $name;
   31: 
   32: 	function bar($w)
   33: 	{
   34: 		$this->name = $w;
   35: 	}
   36: 
   37: 	function getName()
   38: 	{
   39: 		return $this->name;
   40: 	}
   41: 
   42: 	function whosdrunk()
   43: 	{
   44: 		$who = get_parent_class($this);
   45: 		if($who == NULL)
   46: 		{
   47: 			return 'nobody';
   48: 		}
   49: 		return eval("return ".$who.'::getName();');
   50: 	}
   51: }
   52: 
   53: $x = new man;
   54: $x->getdrunk('The old Tavern');
   55: var_dump($x->bars[0]->whosdrunk());
   56: ?>
   57: --EXPECT--
   58: string(14) "The old Tavern"

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