From: Nikita Popov Date: Mon, 28 Jan 2019 16:12:32 +0000 (+0100) Subject: Remove each() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6db97f5e3ea3ac9774a06981226a0fe1bca02b38;p=php Remove each() This has been deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- diff --git a/UPGRADING b/UPGRADING index d587809648..882241eacf 100644 --- 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 index 6120181269..0000000000 --- a/Zend/tests/007.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -each() tests ---FILE-- -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 index f2cae3d875..0000000000 --- a/Zend/tests/each_001.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Testing each() with an undefined variable ---FILE-- - ---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 index 5454f5ce0f..0000000000 --- a/Zend/tests/each_002.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Testing each() with array and object ---FILE-- - ---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 index d0038c0561..0000000000 --- a/Zend/tests/each_003.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Testing each() with recursion ---INI-- -zend.enable_gc=1 ---FILE-- - ---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) -} diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index e8bcc1c980..14c8fd39f9 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -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) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 646f3b927b..edab6edaa7 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -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; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index d558fa9ad8..b996b325c4 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -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]; }; diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 6aea0f6007..7405913846 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -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 index 4af2097a7d..0000000000 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 index cd38682dc7..0000000000 --- a/ext/standard/tests/array/each_basic.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -Test each() function : basic functionality ---FILE-- - 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 index e7ee4976ed..0000000000 --- a/ext/standard/tests/array/each_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test each() function : error conditions - pass incorrect number of args ---FILE-- - ---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 index 6b75d5e15c..0000000000 --- a/ext/standard/tests/array/each_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test each() function : usage variations - Pass different data types as $arr arg ---FILE-- - ---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 index 34eeedc9a8..0000000000 --- a/ext/standard/tests/array/each_variation2.phpt +++ /dev/null @@ -1,249 +0,0 @@ ---TEST-- -Test each() function : usage variations - arrays of different data types ---FILE-- - 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 index 32342d6d78..0000000000 --- a/ext/standard/tests/array/each_variation3.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test each() function : usage variations - keys of different data types ---FILE-- - 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 index 64fbb4a8d0..0000000000 --- a/ext/standard/tests/array/each_variation4.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -Test each() function : usage variations - Referenced variables ---FILE-- - &$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 index 441882f962..0000000000 --- a/ext/standard/tests/array/each_variation5.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -Test each() function : usage variations - Multi-dimensional arrays ---FILE-- - '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 index de52ba5965..0000000000 --- a/ext/standard/tests/array/each_variation6.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test each() function : usage variations - Internal array pointer ---FILE-- - " . 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 index 134df03684..0000000000 --- a/tests/lang/031.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -Bug #16227 (Internal hash position bug on assignment) ---FILE-- - ---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 index ce175495aa..0000000000 --- a/tests/lang/each_binary_safety.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Binary safety of each() for both keys and values ---FILE-- - "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