X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fhtmlform%2Ffields%2FHTMLRestrictionsField.php;h=0310dd024f2053947270c9b85ea77cef15c41db4;hp=dbf2c8f6444c8a25715317aeb16ec4c6159761d7;hb=a8379682a46a428320c88702c800a6107c015137;hpb=ce079cf6ad79ca8d3360817f809b219d166f9153 diff --git a/includes/htmlform/fields/HTMLRestrictionsField.php b/includes/htmlform/fields/HTMLRestrictionsField.php index dbf2c8f644..0310dd024f 100644 --- a/includes/htmlform/fields/HTMLRestrictionsField.php +++ b/includes/htmlform/fields/HTMLRestrictionsField.php @@ -38,7 +38,7 @@ class HTMLRestrictionsField extends HTMLTextAreaField { } $value = rtrim( $request->getText( $this->mName ), "\r\n" ); - $ips = $value === '' ? [] : explode( PHP_EOL, $value ); + $ips = $value === '' ? [] : explode( "\n", $value ); try { return MWRestrictions::newFromArray( [ 'IPAddresses' => $ips ] ); } catch ( InvalidArgumentException $e ) { @@ -79,7 +79,7 @@ class HTMLRestrictionsField extends HTMLTextAreaField { if ( is_string( $value ) ) { // MWRestrictions::newFromArray failed; one of the IP ranges must be invalid $status = Status::newGood(); - foreach ( explode( PHP_EOL, $value ) as $range ) { + foreach ( explode( "\n", $value ) as $range ) { if ( !\IP::isIPAddress( $range ) ) { $status->fatal( 'restrictionsfield-badip', $range ); } @@ -103,7 +103,7 @@ class HTMLRestrictionsField extends HTMLTextAreaField { */ public function getInputHTML( $value ) { if ( $value instanceof MWRestrictions ) { - $value = implode( PHP_EOL, $value->toArray()['IPAddresses'] ); + $value = implode( "\n", $value->toArray()['IPAddresses'] ); } return parent::getInputHTML( $value ); } @@ -114,7 +114,7 @@ class HTMLRestrictionsField extends HTMLTextAreaField { */ public function getInputOOUI( $value ) { if ( $value instanceof MWRestrictions ) { - $value = implode( PHP_EOL, $value->toArray()['IPAddresses'] ); + $value = implode( "\n", $value->toArray()['IPAddresses'] ); } return parent::getInputOOUI( $value ); }