File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug31683.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, 1 month 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 #31683 (changes to $name in __get($name) override future parameters)
    3: --FILE--
    4: <?php
    5: 
    6: class Foo implements ArrayAccess {
    7: 
    8:   function __get($test) {
    9:     var_dump($test);         
   10:     $test = 'bug';
   11:   }
   12: 
   13:   function __set($test, $val) {
   14:     var_dump($test);         
   15:     var_dump($val);
   16:     $test = 'bug';
   17:     $val = 'bug';
   18:   }
   19: 
   20:   function __call($test, $arg) {
   21:     var_dump($test);         
   22:     $test = 'bug';
   23:   }
   24: 
   25:   function offsetget($test) {
   26:     var_dump($test);         
   27:     $test = 'bug';
   28:     return 123;
   29:   }
   30: 
   31:   function offsetset($test, $val) {
   32:     var_dump($test);         
   33:     var_dump($val);         
   34:     $test = 'bug';
   35:     $val  = 'bug';
   36:   }
   37: 
   38:   function offsetexists($test) {
   39:     var_dump($test);         
   40:     $test = 'bug';
   41:   }
   42: 
   43:   function offsetunset($test) {
   44:     var_dump($test);         
   45:     $test = 'bug';
   46:   }
   47: 
   48: }
   49: 
   50: $foo = new Foo();
   51: $a = "ok";
   52: 
   53: for ($i=0; $i < 2; $i++) {
   54:   $foo->ok("ok");
   55:   $foo->ok;
   56:   $foo->ok = "ok";
   57:   $x = $foo["ok"];
   58:   $foo["ok"] = "ok";
   59:   isset($foo["ok"]);
   60:   unset($foo["ok"]);
   61: //  $foo[];
   62:   $foo[] = "ok";
   63: //  isset($foo[]);
   64: //  unset($foo[]);
   65:   $foo->$a;
   66:   echo "---\n";
   67: }
   68: ?>
   69: --EXPECT--
   70: string(2) "ok"
   71: string(2) "ok"
   72: string(2) "ok"
   73: string(2) "ok"
   74: string(2) "ok"
   75: string(2) "ok"
   76: string(2) "ok"
   77: string(2) "ok"
   78: string(2) "ok"
   79: NULL
   80: string(2) "ok"
   81: string(2) "ok"
   82: ---
   83: string(2) "ok"
   84: string(2) "ok"
   85: string(2) "ok"
   86: string(2) "ok"
   87: string(2) "ok"
   88: string(2) "ok"
   89: string(2) "ok"
   90: string(2) "ok"
   91: string(2) "ok"
   92: NULL
   93: string(2) "ok"
   94: string(2) "ok"
   95: ---

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