]> granicus.if.org Git - php/commitdiff
Remove each()
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 28 Jan 2019 16:12:32 +0000 (17:12 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 29 Jan 2019 08:42:59 +0000 (09:42 +0100)
This has been deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.

20 files changed:
UPGRADING
Zend/tests/007.phpt [deleted file]
Zend/tests/each_001.phpt [deleted file]
Zend/tests/each_002.phpt [deleted file]
Zend/tests/each_003.phpt [deleted file]
Zend/zend_builtin_functions.c
Zend/zend_execute_API.c
Zend/zend_globals.h
ext/opcache/Optimizer/zend_func_info.c
ext/standard/tests/array/each.phpt [deleted file]
ext/standard/tests/array/each_basic.phpt [deleted file]
ext/standard/tests/array/each_error.phpt [deleted file]
ext/standard/tests/array/each_variation1.phpt [deleted file]
ext/standard/tests/array/each_variation2.phpt [deleted file]
ext/standard/tests/array/each_variation3.phpt [deleted file]
ext/standard/tests/array/each_variation4.phpt [deleted file]
ext/standard/tests/array/each_variation5.phpt [deleted file]
ext/standard/tests/array/each_variation6.phpt [deleted file]
tests/lang/031.phpt [deleted file]
tests/lang/each_binary_safety.phpt [deleted file]

index d58780964857a800dc688df783b0aecc50990fdb..882241eacf0b109ce7615255efad8002e72335e1 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -24,6 +24,7 @@ PHP 8.0 UPGRADE NOTES
   . Removed track_errors ini directive. This means that $php_errormsg is no
     longer available. The error_get_last() function may be used instead.
   . Removed create_function(). Anonymous functions may be used instead.
+  . Removed each(). foreach or ArrayIterator should be used instead.
 
 - GD:
   . The deprecated function image2wbmp() has been removed.
diff --git a/Zend/tests/007.phpt b/Zend/tests/007.phpt
deleted file mode 100644 (file)
index 6120181..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-each() tests
---FILE--
-<?php
-
-var_dump(each());
-$var = 1;
-var_dump(each($var));
-$var = "string";
-var_dump(each($var));
-$var = array(1,2,3);
-var_dump(each($var));
-$var = array("a"=>1,"b"=>2,"c"=>3);
-var_dump(each($var));
-
-$a = array(1);
-$a [] =&$a[0];
-
-var_dump(each($a));
-
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-array(4) {
-  [1]=>
-  int(1)
-  ["value"]=>
-  int(1)
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-array(4) {
-  [1]=>
-  int(1)
-  ["value"]=>
-  int(1)
-  [0]=>
-  string(1) "a"
-  ["key"]=>
-  string(1) "a"
-}
-array(4) {
-  [1]=>
-  int(1)
-  ["value"]=>
-  int(1)
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-Done
diff --git a/Zend/tests/each_001.phpt b/Zend/tests/each_001.phpt
deleted file mode 100644 (file)
index f2cae3d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Testing each() with an undefined variable
---FILE--
-<?php
-
-each($foo);
-
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
diff --git a/Zend/tests/each_002.phpt b/Zend/tests/each_002.phpt
deleted file mode 100644 (file)
index 5454f5c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Testing each() with array and object
---FILE--
-<?php
-
-$a = new stdClass;
-$foo = each($a);
-var_dump($foo);
-
-$a = new stdClass;
-var_dump(each($a));
-
-$a = array(new stdClass);
-var_dump(each($a));
-
-
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-bool(false)
-bool(false)
-array(4) {
-  [1]=>
-  object(stdClass)#1 (0) {
-  }
-  ["value"]=>
-  object(stdClass)#1 (0) {
-  }
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
diff --git a/Zend/tests/each_003.phpt b/Zend/tests/each_003.phpt
deleted file mode 100644 (file)
index d0038c0..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Testing each() with recursion
---INI--
-zend.enable_gc=1
---FILE--
-<?php
-
-$a = array(array());
-$a[] =& $a;
-
-var_dump(each($a[1]));
-
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
-  [1]=>
-  array(0) {
-  }
-  ["value"]=>
-  array(0) {
-  }
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
index e8bcc1c980e25392b2dd9a1f19f49af362dfab33..14c8fd39f9b82bf88bfaf1c3031ad63d4b03cd35 100644 (file)
@@ -37,7 +37,6 @@ static ZEND_FUNCTION(strcmp);
 static ZEND_FUNCTION(strncmp);
 static ZEND_FUNCTION(strcasecmp);
 static ZEND_FUNCTION(strncasecmp);
-static ZEND_FUNCTION(each);
 static ZEND_FUNCTION(error_reporting);
 static ZEND_FUNCTION(define);
 static ZEND_FUNCTION(defined);
@@ -108,10 +107,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_strncmp, 0, 0, 3)
        ZEND_ARG_INFO(0, len)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_each, 0, 0, 1)
-       ZEND_ARG_INFO(1, arr)
-ZEND_END_ARG_INFO()
-
 ZEND_BEGIN_ARG_INFO_EX(arginfo_error_reporting, 0, 0, 0)
        ZEND_ARG_INFO(0, new_error_level)
 ZEND_END_ARG_INFO()
@@ -238,7 +233,6 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
        ZEND_FE(strncmp,                arginfo_strncmp)
        ZEND_FE(strcasecmp,             arginfo_strcmp)
        ZEND_FE(strncasecmp,            arginfo_strncmp)
-       ZEND_FE(each,                   arginfo_each)
        ZEND_FE(error_reporting,        arginfo_error_reporting)
        ZEND_FE(define,                 arginfo_define)
        ZEND_FE(defined,                arginfo_defined)
@@ -653,66 +647,6 @@ ZEND_FUNCTION(strncasecmp)
 }
 /* }}} */
 
-/* {{{ proto mixed each(array &arr)
-   Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */
-ZEND_FUNCTION(each)
-{
-       zval *array, *entry, tmp;
-       zend_ulong num_key;
-       HashTable *target_hash;
-       zend_string *key;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &array) == FAILURE) {
-               return;
-       }
-
-       if (!EG(each_deprecation_thrown)) {
-               zend_error(E_DEPRECATED, "The each() function is deprecated. This message will be suppressed on further calls");
-               EG(each_deprecation_thrown) = 1;
-       }
-
-       target_hash = HASH_OF(array);
-       if (!target_hash) {
-               zend_error(E_WARNING,"Variable passed to each() is not an array or object");
-               return;
-       }
-       while (1) {
-               entry = zend_hash_get_current_data(target_hash);
-               if (!entry) {
-                       RETURN_FALSE;
-               } else if (Z_TYPE_P(entry) == IS_INDIRECT) {
-                       entry = Z_INDIRECT_P(entry);
-                       if (Z_TYPE_P(entry) == IS_UNDEF) {
-                               zend_hash_move_forward(target_hash);
-                               continue;
-                       }
-               }
-               break;
-       }
-       array_init_size(return_value, 4);
-       zend_hash_real_init_mixed(Z_ARRVAL_P(return_value));
-
-       /* add value elements */
-       ZVAL_DEREF(entry);
-       if (Z_REFCOUNTED_P(entry)) {
-               GC_ADDREF_EX(Z_COUNTED_P(entry), 2);
-       }
-       zend_hash_index_add_new(Z_ARRVAL_P(return_value), 1, entry);
-       zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_VALUE), entry);
-
-       /* add the key elements */
-       if (zend_hash_get_current_key(target_hash, &key, &num_key) == HASH_KEY_IS_STRING) {
-               ZVAL_STR_COPY(&tmp, key);
-               Z_TRY_ADDREF(tmp);
-       } else {
-               ZVAL_LONG(&tmp, num_key);
-       }
-       zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp);
-       zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_KEY), &tmp);
-       zend_hash_move_forward(target_hash);
-}
-/* }}} */
-
 /* {{{ proto int error_reporting([int new_error_level])
    Return the current error_reporting level, and if an argument was passed - change to the new level */
 ZEND_FUNCTION(error_reporting)
index 646f3b927b94bdbc299c40563282f7b95b2e72fd..edab6edaa77a3a4e62c14070b1f794b9ca74c11f 100644 (file)
@@ -177,8 +177,6 @@ void init_executor(void) /* {{{ */
        EG(ht_iterators) = EG(ht_iterators_slots);
        memset(EG(ht_iterators), 0, sizeof(EG(ht_iterators_slots)));
 
-       EG(each_deprecation_thrown) = 0;
-
        EG(persistent_constants_count) = EG(zend_constants)->nNumUsed;
        EG(persistent_functions_count) = EG(function_table)->nNumUsed;
        EG(persistent_classes_count)   = EG(class_table)->nNumUsed;
index d558fa9ad8518bd6e91dd57eff20b02ef568a645..b996b325c4fc8c1d63ebe8de9a4bd508dd2bc62c 100644 (file)
@@ -225,8 +225,6 @@ struct _zend_executor_globals {
        zend_function trampoline;
        zend_op       call_trampoline_op;
 
-       zend_bool each_deprecation_thrown;
-
        void *reserved[ZEND_MAX_RESERVED_RESOURCES];
 };
 
index 6aea0f600710989cde95ab9b56ec36a544013612..7405913846f05cb4a1f3c8bb307be353c5389f3d 100644 (file)
@@ -228,7 +228,6 @@ static const func_info_t func_infos[] = {
        FC("strncmp",                 zend_lb_ssn_info),
        FC("strcasecmp",              zend_l_ss_info),
        FC("strncasecmp",             zend_lb_ssn_info),
-       F1("each",                    MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_KEY_ANY),
        F0("error_reporting",         MAY_BE_NULL | MAY_BE_LONG),
        F0("define",                  MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_NULL), // TODO: inline
        FC("defined",                 zend_b_s_info), // TODO: inline
diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt
deleted file mode 100644 (file)
index 4af2097..0000000
Binary files a/ext/standard/tests/array/each.phpt and /dev/null differ
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt
deleted file mode 100644 (file)
index cd38682..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
---TEST--
-Test each() function : basic functionality
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test basic functionality of each()
- */
-
-echo "*** Testing each() : basic functionality ***\n";
-
-$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty');
-echo "\n-- Passed array: --\n";
-var_dump($arr);
-
-echo "\n-- Initial position: --\n";
-var_dump(each($arr));
-
-echo "\n-- End position: --\n";
-end($arr);
-var_dump(each($arr));
-
-echo "\n-- Passed the end of array: --\n";
-var_dump(each($arr));
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : basic functionality ***
-
--- Passed array: --
-array(4) {
-  ["one"]=>
-  int(1)
-  [0]=>
-  string(4) "zero"
-  ["two"]=>
-  string(4) "deux"
-  [20]=>
-  string(6) "twenty"
-}
-
--- Initial position: --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
-  [1]=>
-  int(1)
-  ["value"]=>
-  int(1)
-  [0]=>
-  string(3) "one"
-  ["key"]=>
-  string(3) "one"
-}
-
--- End position: --
-array(4) {
-  [1]=>
-  string(6) "twenty"
-  ["value"]=>
-  string(6) "twenty"
-  [0]=>
-  int(20)
-  ["key"]=>
-  int(20)
-}
-
--- Passed the end of array: --
-bool(false)
-Done
diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt
deleted file mode 100644 (file)
index e7ee497..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Test each() function : error conditions - pass incorrect number of args
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass an incorrect number of arguments to each() to test behaviour
- */
-
-echo "*** Testing each() : error conditions ***\n";
-
-// Zero arguments
-echo "\n-- Testing each() function with Zero arguments --\n";
-var_dump( each() );
-
-//Test each with one more than the expected number of arguments
-echo "\n-- Testing each() function with more than expected no. of arguments --\n";
-$arr = array(1, 2);
-$extra_arg = 10;
-var_dump( each($arr, $extra_arg) );
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : error conditions ***
-
--- Testing each() function with Zero arguments --
-
-Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing each() function with more than expected no. of arguments --
-
-Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt
deleted file mode 100644 (file)
index 6b75d5e..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
---TEST--
-Test each() function : usage variations - Pass different data types as $arr arg
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass different data types as $arr arg to each() to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
-  public function __toString() {
-    return "Class A object";
-  }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $arr argument
-$inputs = array(
-
-       // int data
-/*1*/  0,
-       1,
-       12345,
-       -2345,
-
-       // float data
-/*5*/  10.5,
-       -10.5,
-       12.3456789000e10,
-       12.3456789000E-10,
-       .5,
-
-       // null data
-/*10*/ NULL,
-       null,
-
-       // boolean data
-/*12*/ true,
-       false,
-       TRUE,
-       FALSE,
-
-       // empty data
-/*16*/ "",
-       '',
-       array(),
-
-       // string data
-/*19*/ "string",
-       'string',
-       $heredoc,
-
-       // object data
-/*22*/ new classA(),
-
-       // undefined data
-/*23*/ @$undefined_var,
-
-       // unset data
-/*24*/ @$unset_var,
-
-       // resource variable
-/*25*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $input) {
-  echo "\n-- Iteration $iterator --\n";
-  var_dump( each($input) );
-  $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1 --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 2 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 18 --
-bool(false)
-
--- Iteration 19 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 22 --
-bool(false)
-
--- Iteration 23 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt
deleted file mode 100644 (file)
index 34eeedc..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
---TEST--
-Test each() function : usage variations - arrays of different data types
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass arrays of different data types as $arr argument to each() to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
-  public function __toString() {
-    return "Class A object";
-  }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// arrays of different data types to be passed as $arr
-$inputs = array(
-
-       // int data
-/*1*/  'int' => array(
-          0,
-       1,
-       12345,
-       -2345,
-       ),
-
-       // float data
-/*2*/  'float' => array(
-       10.5,
-       -10.5,
-       12.3456789000e10,
-       12.3456789000E-10,
-       .5,
-       ),
-
-       // null data
-/*3*/ 'null' => array(
-       NULL,
-       null,
-       ),
-
-       // boolean data
-/*4*/ 'bool' => array(
-       true,
-       false,
-       TRUE,
-       FALSE,
-       ),
-
-       // empty data
-/*5*/ 'empty string' => array(
-       "",
-       '',
-       ),
-
-/*6*/ 'empty array' => array(
-       ),
-
-       // string data
-/*7*/ 'string' => array(
-       "string",
-       'string',
-       $heredoc,
-       ),
-
-       // object data
-/*8*/ 'object' => array(
-       new classA(),
-       ),
-
-       // undefined data
-/*9*/ 'undefined' => array(
-       @$undefined_var,
-       ),
-
-       // unset data
-/*10*/ 'unset' => array(
-       @$unset_var,
-       ),
-
-       // resource variable
-/*11*/ 'resource' => array(
-       $fp
-       ),
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $key => $input) {
-  echo "\n-- Iteration $iterator: $key data --\n";
-  var_dump( each($input) );
-  $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1: int data --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
-  [1]=>
-  int(0)
-  ["value"]=>
-  int(0)
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 2: float data --
-array(4) {
-  [1]=>
-  float(10.5)
-  ["value"]=>
-  float(10.5)
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 3: null data --
-array(4) {
-  [1]=>
-  NULL
-  ["value"]=>
-  NULL
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 4: bool data --
-array(4) {
-  [1]=>
-  bool(true)
-  ["value"]=>
-  bool(true)
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 5: empty string data --
-array(4) {
-  [1]=>
-  string(0) ""
-  ["value"]=>
-  string(0) ""
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 6: empty array data --
-bool(false)
-
--- Iteration 7: string data --
-array(4) {
-  [1]=>
-  string(6) "string"
-  ["value"]=>
-  string(6) "string"
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 8: object data --
-array(4) {
-  [1]=>
-  object(classA)#%d (0) {
-  }
-  ["value"]=>
-  object(classA)#%d (0) {
-  }
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 9: undefined data --
-array(4) {
-  [1]=>
-  NULL
-  ["value"]=>
-  NULL
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 10: unset data --
-array(4) {
-  [1]=>
-  NULL
-  ["value"]=>
-  NULL
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 11: resource data --
-array(4) {
-  [1]=>
-  resource(%d) of type (stream)
-  ["value"]=>
-  resource(%d) of type (stream)
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-Done
diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt
deleted file mode 100644 (file)
index 32342d6..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
---TEST--
-Test each() function : usage variations - keys of different data types
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass each() arrays where the keys are different data types to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// unexpected values to be passed as $arr
-$inputs = array(
-
-       // int data
-/*1*/  'int' => array(
-       0 => 'zero',
-       1 => 'one',
-       12345 => 'positive',
-       -2345 => 'negative',
-       ),
-
-       // float data
-/*2*/  'float' => array(
-       10.5 => 'positive',
-       -10.5 => 'negative',
-       .5 => 'half',
-       ),
-
-/*3*/  'extreme floats' => array(
-       12.3456789000e6 => 'large',
-       12.3456789000E-10 => 'small',
-       ),
-
-       // null data
-/*4*/ 'null uppercase' => array(
-       NULL => 'null 1',
-       ),
-
-/*5*/  'null lowercase' => array(
-       null => 'null 2',
-       ),
-
-       // boolean data
-/*6*/ 'bool lowercase' => array(
-       true => 'lowert',
-       false => 'lowerf',
-       ),
-
-/*7*/  'bool uppercase' => array(
-       TRUE => 'uppert',
-       FALSE => 'upperf',
-       ),
-
-       // empty data
-/*8*/ 'empty double quotes' => array(
-       "" => 'emptyd',
-       ),
-
-/*9*/  'empty single quotes' => array(
-       '' => 'emptys',
-       ),
-
-       // string data
-/*10*/ 'string' => array(
-       "stringd" => 'stringd',
-       'strings' => 'strings',
-       $heredoc => 'stringh',
-       ),
-
-       // undefined data
-/*11*/ 'undefined' => array(
-       @$undefined_var => 'undefined',
-       ),
-
-       // unset data
-/*12*/ 'unset' => array(
-       @$unset_var => 'unset',
-       ),
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $key => $input) {
-  echo "\n-- Iteration $iterator: $key data --\n";
-  var_dump( each($input) );
-  $iterator++;
-};
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1: int data --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
-  [1]=>
-  string(4) "zero"
-  ["value"]=>
-  string(4) "zero"
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- Iteration 2: float data --
-array(4) {
-  [1]=>
-  string(8) "positive"
-  ["value"]=>
-  string(8) "positive"
-  [0]=>
-  int(10)
-  ["key"]=>
-  int(10)
-}
-
--- Iteration 3: extreme floats data --
-array(4) {
-  [1]=>
-  string(5) "large"
-  ["value"]=>
-  string(5) "large"
-  [0]=>
-  int(12345678)
-  ["key"]=>
-  int(12345678)
-}
-
--- Iteration 4: null uppercase data --
-array(4) {
-  [1]=>
-  string(6) "null 1"
-  ["value"]=>
-  string(6) "null 1"
-  [0]=>
-  string(0) ""
-  ["key"]=>
-  string(0) ""
-}
-
--- Iteration 5: null lowercase data --
-array(4) {
-  [1]=>
-  string(6) "null 2"
-  ["value"]=>
-  string(6) "null 2"
-  [0]=>
-  string(0) ""
-  ["key"]=>
-  string(0) ""
-}
-
--- Iteration 6: bool lowercase data --
-array(4) {
-  [1]=>
-  string(6) "lowert"
-  ["value"]=>
-  string(6) "lowert"
-  [0]=>
-  int(1)
-  ["key"]=>
-  int(1)
-}
-
--- Iteration 7: bool uppercase data --
-array(4) {
-  [1]=>
-  string(6) "uppert"
-  ["value"]=>
-  string(6) "uppert"
-  [0]=>
-  int(1)
-  ["key"]=>
-  int(1)
-}
-
--- Iteration 8: empty double quotes data --
-array(4) {
-  [1]=>
-  string(6) "emptyd"
-  ["value"]=>
-  string(6) "emptyd"
-  [0]=>
-  string(0) ""
-  ["key"]=>
-  string(0) ""
-}
-
--- Iteration 9: empty single quotes data --
-array(4) {
-  [1]=>
-  string(6) "emptys"
-  ["value"]=>
-  string(6) "emptys"
-  [0]=>
-  string(0) ""
-  ["key"]=>
-  string(0) ""
-}
-
--- Iteration 10: string data --
-array(4) {
-  [1]=>
-  string(7) "stringd"
-  ["value"]=>
-  string(7) "stringd"
-  [0]=>
-  string(7) "stringd"
-  ["key"]=>
-  string(7) "stringd"
-}
-
--- Iteration 11: undefined data --
-array(4) {
-  [1]=>
-  string(9) "undefined"
-  ["value"]=>
-  string(9) "undefined"
-  [0]=>
-  string(0) ""
-  ["key"]=>
-  string(0) ""
-}
-
--- Iteration 12: unset data --
-array(4) {
-  [1]=>
-  string(5) "unset"
-  ["value"]=>
-  string(5) "unset"
-  [0]=>
-  string(0) ""
-  ["key"]=>
-  string(0) ""
-}
-Done
diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt
deleted file mode 100644 (file)
index 64fbb4a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-Test each() function : usage variations - Referenced variables
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test behaviour of each() when:
- * 1. Passed an array made up of referenced variables
- * 2. Passed an array as $arr argument by reference
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-echo "\n-- Array made up of referenced variables: --\n";
-$val1 = 'foo';
-$val2 = 'bar';
-
-$arr1 = array('one' => &$val1, &$val2);
-
-echo "-- Call each until at the end of the array: --\n";
-var_dump( each($arr1) );
-var_dump( each($arr1) );
-var_dump( each($arr1) );
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Array made up of referenced variables: --
--- Call each until at the end of the array: --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
-  [1]=>
-  string(3) "foo"
-  ["value"]=>
-  string(3) "foo"
-  [0]=>
-  string(3) "one"
-  ["key"]=>
-  string(3) "one"
-}
-array(4) {
-  [1]=>
-  string(3) "bar"
-  ["value"]=>
-  string(3) "bar"
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-bool(false)
-Done
diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt
deleted file mode 100644 (file)
index 441882f..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
---TEST--
-Test each() function : usage variations - Multi-dimensional arrays
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test behaviour of each() when passed:
- * 1. a two-dimensional array
- * 2. a sub-array
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-$arr = array ('zero',
-              array(1, 2, 3),
-              'one' => 'un',
-              array('a', 'b', 'c')
-              );
-
-echo "\n-- Pass each() a two-dimensional array --\n";
-for ($i = 1; $i < count($arr); $i++) {
-       var_dump( each($arr) );
-}
-
-echo "\n-- Pass each() a sub-array --\n";
-var_dump( each($arr[2]));
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Pass each() a two-dimensional array --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
-  [1]=>
-  string(4) "zero"
-  ["value"]=>
-  string(4) "zero"
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-array(4) {
-  [1]=>
-  array(3) {
-    [0]=>
-    int(1)
-    [1]=>
-    int(2)
-    [2]=>
-    int(3)
-  }
-  ["value"]=>
-  array(3) {
-    [0]=>
-    int(1)
-    [1]=>
-    int(2)
-    [2]=>
-    int(3)
-  }
-  [0]=>
-  int(1)
-  ["key"]=>
-  int(1)
-}
-array(4) {
-  [1]=>
-  string(2) "un"
-  ["value"]=>
-  string(2) "un"
-  [0]=>
-  string(3) "one"
-  ["key"]=>
-  string(3) "one"
-}
-
--- Pass each() a sub-array --
-array(4) {
-  [1]=>
-  string(1) "a"
-  ["value"]=>
-  string(1) "a"
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-Done
diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt
deleted file mode 100644 (file)
index de52ba5..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-Test each() function : usage variations - Internal array pointer
---FILE--
-<?php
-/* Prototype  : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test the position of the internal array pointer after a call to each()
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-$arr = array('zero', 'one', 'two', 'abc', 'xyz');
-
-echo "\n-- Current position: --\n";
-echo key($arr) . " => " . current($arr) . "\n";
-
-echo "\n-- Call to each(): --\n";
-var_dump( each($arr) );
-
-echo "\n-- New position: --\n";
-echo key($arr) . " => " . current($arr) . "\n";
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Current position: --
-0 => zero
-
--- Call to each(): --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
-  [1]=>
-  string(4) "zero"
-  ["value"]=>
-  string(4) "zero"
-  [0]=>
-  int(0)
-  ["key"]=>
-  int(0)
-}
-
--- New position: --
-1 => one
-Done
diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt
deleted file mode 100644 (file)
index 134df03..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-Bug #16227 (Internal hash position bug on assignment)
---FILE--
-<?php
-// reported by php.net@alienbill.com
-$arrayOuter = array("key1","key2");
-$arrayInner = array("0","1");
-
-print "Correct - with inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
-       reset($arrayInner);
-       while(list(,$i) = each($arrayInner)){
-               print "inloop $i for $o\n";
-       }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
-       while(list(,$i) = each($arrayInner)){
-               print "inloop $i for $o\n";
-       }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset but copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
-       $placeholder = $arrayInner;
-       while(list(,$i) = each($arrayInner)){
-               print "inloop $i for $o\n";
-       }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens with inner loop reset over copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
-       $placeholder = $arrayInner;
-       while(list(,$i) = each($placeholder)){
-               print "inloop $i for $o\n";
-       }
-}
-reset($arrayOuter);
-reset($arrayInner);
-?>
---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
-inloop 1 for key2
-What happens without inner loop reset.
-inloop 0 for key1
-inloop 1 for key1
-What happens without inner loop reset but copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
-What happens with inner loop reset over copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
diff --git a/tests/lang/each_binary_safety.phpt b/tests/lang/each_binary_safety.phpt
deleted file mode 100644 (file)
index ce17549..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Binary safety of each() for both keys and values
---FILE--
-<?php
-error_reporting(E_ALL);
-$arr = array ("foo\0bar" => "foo\0bar");
-while (list($key, $val) = each($arr)) {
-       echo strlen($key), ': ';
-       echo urlencode($key), ' => ', urlencode($val), "\n";
-}
-?>
---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