I am using git branch REL1_29. After switching to PHP 7.2beta3, I saw the following error on most pages:
> Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/ibwiki/w/includes/MagicWordArray.php on line 197
I have the following settings:
> error_reporting( E_ALL );
> ini_set( 'display_errors', 1 );
The code in question starts:
> public function parseMatch( $m ) {
> reset( $m );
> while ( list( $key, $value ) = @each( $m ) ) {
I removed the reset and changed the while/each to a foreach as so:
> public function parseMatch( $m ) {
> foreach ( $m as $key => $value ) {
This appears to work (and in theory foreach should be faster/easier to optimize), however I don't know if any other code in this function or elsewhere relies on the differences between each() and foreach(), such as the side-effect of array iteration or the ability to edit the array, rather than work on a copy of the array.
```
--- a/includes/MagicWordArray.php
+++ b/includes/MagicWordArray.php
@@ -193,8 +193,7 @@ class MagicWordArray {
* @return array
*/
public function parseMatch( $m ) {
- reset( $m );
- while ( list( $key, $value ) = each( $m ) ) {
+ foreach ( $m as $key => $value ) {
if ( $key === 0 || $value === '' ) {
continue;
}
```