File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / lang / this_assignment.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, 5 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: Test to catch early assignment of $this
    3: --FILE--
    4: <?php
    5: class first {
    6: 
    7:    function me() { echo "first"; }
    8: 
    9:    function who() { 
   10:      global $a,$b;
   11:      $this->me();
   12:      $a->me();
   13:      $b->me();
   14:      $b = new second();
   15:      $this->me();
   16:      $a->me();
   17:      $b->me();
   18:    }
   19: }
   20: 
   21: class second {
   22: 
   23:    function who() { 
   24:       global $a,$b;
   25:       $this->me();
   26:       $a->me();
   27:       $b->me();
   28:    }
   29:    function me() { echo "second"; }
   30: }
   31: 
   32: $a = new first();
   33: $b = &$a;
   34: 
   35: $a->who();
   36: $b->who();
   37: 
   38: echo "\n";
   39: ?>
   40: ===DONE===
   41: --EXPECT--
   42: firstfirstfirstfirstsecondsecondsecondsecondsecond
   43: ===DONE===

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