From 06a034016280435feb80eea4d674ca5688ab4c06 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 2 Feb 2017 23:07:25 +0100 Subject: Deprecate each() --- tests/classes/iterators_006.phpt | 7 +++---- tests/lang/031.phpt | 4 +++- tests/lang/each_binary_safety.phpt | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/classes/iterators_006.phpt b/tests/classes/iterators_006.phpt index 8017a8a360..564f15de54 100644 --- a/tests/classes/iterators_006.phpt +++ b/tests/classes/iterators_006.phpt @@ -29,10 +29,9 @@ class ai implements Iterator { } function next() { - list($this->key, $this->current) = each($this->array); -// list($key, $current) = each($this->array); -// $this->key = $key; -// $this->current = $current; + $this->key = key($this->array); + $this->current = current($this->array); + next($this->array); } } diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt index b2d1e631ec..134df03684 100644 --- a/tests/lang/031.phpt +++ b/tests/lang/031.phpt @@ -49,8 +49,10 @@ while(list(,$o) = each($arrayOuter)){ reset($arrayOuter); reset($arrayInner); ?> ---EXPECT-- +--EXPECTF-- Correct - with inner loop reset. + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d inloop 0 for key1 inloop 1 for key1 inloop 0 for key2 diff --git a/tests/lang/each_binary_safety.phpt b/tests/lang/each_binary_safety.phpt index bb13534546..37b18b32c7 100644 --- a/tests/lang/each_binary_safety.phpt +++ b/tests/lang/each_binary_safety.phpt @@ -9,5 +9,7 @@ while (list($key, $val) = each($arr)) { echo urlencode($key), ' => ', urlencode($val), "\n"; } ?> ---EXPECT-- +--EXPECTF-- + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d 7: foo%00bar => foo%00bar -- cgit v1.2.1