helly Sun Jun 19 16:49:18 2005 EDT
Modified files:
/php-src/tests/classes array_access_003.phpt array_access_005.phpt
array_access_008.phpt
Log:
- Update tests to reflect current situation
# I don't feel like discussing this issue anymore - maybe we need to find
# a way of returning proxies to get the requested behavior back - i'll give
# it a try for PHP 5.2. So long we'll have to stay with the original
# decision that we don't support references at all with ArrayAccess.
http://cvs.php.net/diff.php/php-src/tests/classes/array_access_003.phpt?r1=1.5&r2=1.6&ty=u
Index: php-src/tests/classes/array_access_003.phpt
diff -u php-src/tests/classes/array_access_003.phpt:1.5
php-src/tests/classes/array_access_003.phpt:1.6
--- php-src/tests/classes/array_access_003.phpt:1.5 Thu Apr 28 21:18:40 2005
+++ php-src/tests/classes/array_access_003.phpt Sun Jun 19 16:49:17 2005
@@ -12,7 +12,7 @@
echo __METHOD__ . "($index)\n";
return array_key_exists($index, $this->a);
}
- function &offsetGet($index) {
+ function offsetGet($index) {
echo __METHOD__ . "($index)\n";
switch($index) {
case 1:
@@ -48,12 +48,9 @@
===DONE===
--EXPECTF--
object::offsetGet(1)
-
-Strict Standards: Only variable references should be returned by reference in
%sarray_access_003.php on line %d
string(6) "fooBar"
object::offsetGet(2)
int(1)
object::offsetGet(2)
-object::offsetGet(2)
-int(2)
-===DONE===
+
+Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_003.php on line %d
http://cvs.php.net/diff.php/php-src/tests/classes/array_access_005.phpt?r1=1.3&r2=1.4&ty=u
Index: php-src/tests/classes/array_access_005.phpt
diff -u php-src/tests/classes/array_access_005.phpt:1.3
php-src/tests/classes/array_access_005.phpt:1.4
--- php-src/tests/classes/array_access_005.phpt:1.3 Thu Feb 12 09:12:37 2004
+++ php-src/tests/classes/array_access_005.phpt Sun Jun 19 16:49:17 2005
@@ -14,7 +14,7 @@
return array_key_exists($this->person, $index);
}
- function &offsetGet($index) {
+ function offsetGet($index) {
return $this->person[$index];
}
@@ -39,20 +39,34 @@
$people = new Peoples;
+var_dump($people[0]);
var_dump($people[0]['name']);
-$people[0]['name'] = $people->person[0]['name'] . 'Foo';
+var_dump($people->person[0]['name'] . 'Foo'); // impossible to assign this
since we don't return references here
+$x = $people[0]; // creates a copy
+$x['name'] .= 'Foo';
+$people[0] = $x;
+var_dump($people[0]);
+$people[0]['name'] = 'JoeFoo';
var_dump($people[0]['name']);
-$people[0]['name'] .= 'Bar';
+$people[0]['name'] = 'JoeFooBar';
var_dump($people[0]['name']);
-echo "---Done---\n";
?>
---EXPECT--
+===DONE===
+--EXPECTF--
string(3) "Joe"
string(6) "JoeFoo"
string(9) "JoeFooBar"
---ArrayOverloading---
+array(1) {
+ ["name"]=>
+ string(3) "Joe"
+}
string(3) "Joe"
string(6) "JoeFoo"
-string(9) "JoeFooBar"
----Done---
+array(1) {
+ ["name"]=>
+ string(6) "JoeFoo"
+}
+
+Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_005.php on line %d
http://cvs.php.net/diff.php/php-src/tests/classes/array_access_008.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/tests/classes/array_access_008.phpt
diff -u php-src/tests/classes/array_access_008.phpt:1.1
php-src/tests/classes/array_access_008.phpt:1.2
--- php-src/tests/classes/array_access_008.phpt:1.1 Wed Sep 29 05:36:23 2004
+++ php-src/tests/classes/array_access_008.phpt Sun Jun 19 16:49:17 2005
@@ -14,7 +14,7 @@
return array_key_exists($this->person, $index);
}
- function & offsetGet($index) {
+ function offsetGet($index) {
return $this->person[$index];
}
@@ -40,6 +40,8 @@
$people = new Peoples;
var_dump($people[0]['name']);
+$people[0]['name'] = 'FooBar';
+var_dump($people[0]['name']);
$people[0]['name'] = $people->person[0]['name'] . 'Bar';
var_dump($people[0]['name']);
$people[0]['name'] .= 'Baz';
@@ -47,12 +49,11 @@
?>
===DONE===
---EXPECT--
+--EXPECTF--
string(3) "Foo"
string(6) "FooBar"
string(9) "FooBarBaz"
===ArrayOverloading===
string(3) "Foo"
-string(6) "FooBar"
-string(9) "FooBarBaz"
-===DONE===
+
+Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_008.php on line %d
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php