~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to Zend/tests/bug31683.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

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