Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebaf4cf

Browse files
committed
Merge pull request inex#214 from rowanthorpe/add-encoding-to-zend-string-validate
Ensure string-validate uses UTF-8, not system-default
2 parents 8d5b472 + 7a07a55 commit ebaf4cf

32 files changed

Lines changed: 149 additions & 149 deletions

library/IXP/Form/Auth/ResetPassword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function init()
4242
$this->addElement(
4343
OSS_Form_Auth::createPasswordElement()
4444
->removeValidator( 'stringLength' )
45-
->addValidator( 'stringLength', false, array( 8, 30 ) )
45+
->addValidator( 'stringLength', false, array( 8, 30, 'UTF-8' ) )
4646
);
4747
$this->addElement( OSS_Form_Auth::createPasswordConfirmElement() );
4848
$this->addElement( OSS_Form::createSubmitElement( 'submit', _( 'Reset Password' ) ) );

library/IXP/Form/Cabinet.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class IXP_Form_Cabinet extends IXP_Form
3636
public function init()
3737
{
3838
$name = $this->createElement( 'text', 'name' );
39-
$name->addValidator( 'stringLength', false, array( 1, 255 ) )
39+
$name->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
4040
->setRequired( true )
4141
->setAttrib( 'class', 'span3' )
4242
->setLabel( 'Name' )
@@ -49,7 +49,7 @@ public function init()
4949

5050

5151
$cololocation = $this->createElement( 'text', 'cololocation' );
52-
$cololocation->addValidator( 'stringLength', false, array( 1, 255 ) )
52+
$cololocation->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
5353
->setAttrib( 'class', 'span3' )
5454
->setRequired( true )
5555
->setLabel( 'Colo Location' )
@@ -59,7 +59,7 @@ public function init()
5959

6060

6161
$type = $this->createElement( 'text', 'type' );
62-
$type->addValidator( 'stringLength', false, array( 1, 255 ) )
62+
$type->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
6363
->setAttrib( 'class', 'span3' )
6464
->setRequired( false )
6565
->setLabel( 'Type' )

library/IXP/Form/ChangePassword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function init()
4848
$this->addElement(
4949
OSS_Form_Auth::createPasswordElement( 'new_password' )
5050
->removeValidator( 'stringLength' )
51-
->addValidator( 'stringLength', false, array( 8, 255 ) )
51+
->addValidator( 'stringLength', false, array( 8, 255, 'UTF-8' ) )
5252
->setLabel( _( 'New Password' ) )
5353
->setAttrib( 'class', 'span6' )
5454
);

library/IXP/Form/ConsoleServerConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class IXP_Form_ConsoleServerConnection extends IXP_Form
3535
public function init()
3636
{
3737
$description = $this->createElement( 'text', 'description' );
38-
$description->addValidator( 'stringLength', false, array( 1, 255 ) )
38+
$description->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
3939
->setRequired( true )
4040
->setAttrib( 'class', 'span3' )
4141
->setLabel( 'Description' )
@@ -48,7 +48,7 @@ public function init()
4848
$this->addElement( IXP_Form_Switch::getPopulatedSelect( 'switchid', \Entities\Switcher::TYPE_CONSOLESERVER ) );
4949

5050
$port = $this->createElement( 'text', 'port' );
51-
$port->addValidator( 'stringLength', false, array( 1, 255 ) )
51+
$port->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
5252
->setRequired( true )
5353
->setLabel( 'Port' )
5454
->setAttrib( 'class', 'span3' )

library/IXP/Form/Contact.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function init()
3737
$this->setDecorators( [ [ 'ViewScript', [ 'viewScript' => 'contact/forms/edit.phtml' ] ] ] );
3838

3939
$name = $this->createElement( 'text', 'name' );
40-
$name->addValidator( 'stringLength', false, array( 1, 255 ) )
40+
$name->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
4141
->setRequired( true )
4242
->setLabel( 'Name' )
4343
//->setAttrib( 'class', 'span3' )
@@ -47,7 +47,7 @@ public function init()
4747
$this->addElement( $name );
4848

4949
$position = $this->createElement( 'text', 'position' );
50-
$position->addValidator( 'stringLength', false, array( 1, 50 ) )
50+
$position->addValidator( 'stringLength', false, array( 1, 50, 'UTF-8' ) )
5151
->setRequired( false )
5252
->setLabel( 'Position' )
5353
//->setAttrib( 'class', 'span3' )
@@ -66,7 +66,7 @@ public function init()
6666
->setAttrib( 'class', "" );
6767

6868
$phone = $this->createElement( 'text', 'phone' );
69-
$phone->addValidator( 'stringLength', false, array( 1, 32 ) )
69+
$phone->addValidator( 'stringLength', false, array( 1, 32, 'UTF-8' ) )
7070
->setLabel( _( 'Phone' ) )
7171
//->setAttrib( 'class', 'span3' )
7272
->addFilter( 'StringTrim' )
@@ -75,7 +75,7 @@ public function init()
7575
$this->addElement( $phone );
7676

7777
$mobile = $this->createElement( 'text', 'mobile' );
78-
$mobile->addValidator( 'stringLength', false, array( 1, 32 ) )
78+
$mobile->addValidator( 'stringLength', false, array( 1, 32, 'UTF-8' ) )
7979
->setLabel( _( 'Mobile' ) )
8080
->addFilter( 'StringTrim' )
8181
->addFilter( 'StripTags' )
@@ -125,14 +125,14 @@ public function init()
125125
$this->addElement( $login );
126126

127127
$username = OSS_Form_Auth::createUsernameElement();
128-
$username->addValidator( 'stringLength', false, array( 2, 30 ) )
128+
$username->addValidator( 'stringLength', false, array( 2, 30, 'UTF-8' ) )
129129
->addValidator( 'regex', true, array( '/^[a-zA-Z0-9\-_\.]+$/' ) )
130130
->setRequired( false )
131131
->setAttrib( 'class', '' );
132132
$this->addElement( $username );
133133

134134
$password = $this->createElement( 'text', 'password' );
135-
$password->addValidator( 'stringLength', false, array( 8, 30 ) )
135+
$password->addValidator( 'stringLength', false, array( 8, 30, 'UTF-8' ) )
136136
->setRequired( false )
137137
//->setAttrib( 'class', 'span3' )
138138
->setLabel( 'Password' )

library/IXP/Form/ContactGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class IXP_Form_ContactGroup extends IXP_Form
3636
public function init()
3737
{
3838
$name = $this->createElement( 'text', 'name' );
39-
$name->addValidator( 'stringLength', false, array( 1, 20 ) )
39+
$name->addValidator( 'stringLength', false, array( 1, 20, 'UTF-8' ) )
4040
->setRequired( true )
4141
->setLabel( 'Name' )
4242
->setAttrib( 'class', 'span3' )
@@ -45,7 +45,7 @@ public function init()
4545
$this->addElement( $name );
4646

4747
$description = $this->createElement( 'text', 'description' );
48-
$description->addValidator( 'stringLength', false, array( 0, 255 ) )
48+
$description->addValidator( 'stringLength', false, array( 0, 255, 'UTF-8' ) )
4949
->setRequired( false )
5050
->setLabel( 'Description' )
5151
->setAttrib( 'class', 'span3' )

library/IXP/Form/CustKit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class IXP_Form_CustKit extends IXP_Form
3636
public function init()
3737
{
3838
$name = $this->createElement( 'text', 'name' );
39-
$name->addValidator( 'stringLength', false, array( 1, 255 ) )
39+
$name->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
4040
->setRequired( true )
4141
->setLabel( 'Name' )
4242
->setAttrib( 'class', 'span3' )

library/IXP/Form/Customer.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function init()
3838
$this->setDecorators( [ [ 'ViewScript', [ 'viewScript' => 'customer/forms/edit.phtml' ] ] ] );
3939

4040
$name = $this->createElement( 'text', 'name' );
41-
$name->addValidator( 'stringLength', false, array( 1, 255 ) )
41+
$name->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
4242
->setRequired( true )
4343
->setLabel( 'Name' )
4444
->setAttrib( 'class', 'span10' )
@@ -56,7 +56,7 @@ public function init()
5656
$this->addElement( $type );
5757

5858
$shortname = $this->createElement( 'text', 'shortname' );
59-
$shortname->addValidator( 'stringLength', false, array( 1, 255 ) )
59+
$shortname->addValidator( 'stringLength', false, array( 1, 255, 'UTF-8' ) )
6060
->addValidator( 'alnum' )
6161
->addValidator( 'regex', false, array('/^[a-z0-9]+/' ) )
6262
->setRequired( true )
@@ -67,7 +67,7 @@ public function init()
6767
$this->addElement( $shortname );
6868

6969
$corpwww = $this->createElement( 'text', 'corpwww' );
70-
$corpwww->addValidator( 'stringLength', false, array( 0, 255 ) )
70+
$corpwww->addValidator( 'stringLength', false, array( 0, 255, 'UTF-8' ) )
7171
->setRequired( false )
7272
->setAttrib( 'placeholder', 'http://www.example.com/' )
7373
->setAttrib( 'class', 'span10' )
@@ -77,7 +77,7 @@ public function init()
7777
$this->addElement( $corpwww );
7878

7979
$datejoin = $this->createElement( 'text', 'datejoin' );
80-
$datejoin->addValidator( 'stringLength', false, array( 10, 10 ) )
80+
$datejoin->addValidator( 'stringLength', false, array( 10, 10, 'UTF-8' ) )
8181
->addValidator( 'regex', false, array('/^\d\d\d\d-\d\d-\d\d/' ) )
8282
->setRequired( false )
8383
->setLabel( 'Date Joined' )
@@ -88,7 +88,7 @@ public function init()
8888
$this->addElement( $datejoin );
8989

9090
$dateleave = $this->createElement( 'text', 'dateleave' );
91-
$dateleave->addValidator( 'stringLength', false, array( 10, 10 ) )
91+
$dateleave->addValidator( 'stringLength', false, array( 10, 10, 'UTF-8' ) )
9292
->addValidator( 'regex', false, array('/^\d\d\d\d-\d\d-\d\d/' ) )
9393
->setRequired( false )
9494
->setAttrib( 'placeholder', 'YYYY-MM-DD' )
@@ -141,7 +141,7 @@ public function init()
141141

142142
$peeringemail = $this->createElement( 'text', 'peeringemail' );
143143
$peeringemail->addValidator('emailAddress' )
144-
->addValidator( 'stringLength', false, array( 0, 64 ) )
144+
->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
145145
->setRequired( false )
146146
->setAttrib( 'class', 'span8' )
147147
->setAttrib( 'placeholder', '[email protected]' )
@@ -159,7 +159,7 @@ public function init()
159159

160160

161161
$peeringmacro = $this->createElement( 'text', 'peeringmacro' );
162-
$peeringmacro->addValidator( 'stringLength', false, array( 0, 255 ) )
162+
$peeringmacro->addValidator( 'stringLength', false, array( 0, 255, 'UTF-8' ) )
163163
->setRequired( false )
164164
->setLabel( 'Peering Macro' )
165165
->addFilter( 'StringTrim' )
@@ -185,7 +185,7 @@ public function init()
185185
$this->getDisplayGroup( 'peeringDisplayGroup' )->setLegend( 'Peering Details' );
186186

187187
$nocphone = $this->createElement( 'text', 'nocphone' );
188-
$nocphone->addValidator( 'stringLength', false, array( 0, 255 ) )
188+
$nocphone->addValidator( 'stringLength', false, array( 0, 255, 'UTF-8' ) )
189189
->setRequired( false )
190190
->setLabel( 'Phone' )
191191
->setAttrib( 'placeholder', '+353 1 123 4567' )
@@ -195,7 +195,7 @@ public function init()
195195
$this->addElement( $nocphone );
196196

197197
$noc24hphone = $this->createElement( 'text', 'noc24hphone' );
198-
$noc24hphone->addValidator( 'stringLength', false, array( 0, 255 ) )
198+
$noc24hphone->addValidator( 'stringLength', false, array( 0, 255, 'UTF-8' ) )
199199
->setRequired( false )
200200
->setAttrib( 'placeholder', '+353 86 876 5432' )
201201
->setAttrib( 'class', 'span8' )
@@ -205,7 +205,7 @@ public function init()
205205
$this->addElement( $noc24hphone );
206206

207207
$nocfax = $this->createElement( 'text', 'nocfax' );
208-
$nocfax->addValidator( 'stringLength', false, array( 0, 40 ) )
208+
$nocfax->addValidator( 'stringLength', false, array( 0, 40, 'UTF-8' ) )
209209
->setRequired( false )
210210
->setLabel( 'Fax' )
211211
->setAttrib( 'placeholder', '+353 1 765 4321' )
@@ -216,7 +216,7 @@ public function init()
216216

217217
$nocemail = $this->createElement( 'text', 'nocemail' );
218218
$nocemail->addValidator('emailAddress' )
219-
->addValidator( 'stringLength', false, array( 0, 40 ) )
219+
->addValidator( 'stringLength', false, array( 0, 40, 'UTF-8' ) )
220220
->setRequired( false )
221221
->setAttrib( 'class', 'span8' )
222222
->setAttrib( 'placeholder', '[email protected]' )
@@ -233,7 +233,7 @@ public function init()
233233

234234

235235
$nocwww = $this->createElement( 'text', 'nocwww' );
236-
$nocwww->addValidator( 'stringLength', false, array( 0, 255 ) )
236+
$nocwww->addValidator( 'stringLength', false, array( 0, 255, 'UTF-8' ) )
237237
->setRequired( false )
238238
->setLabel( 'Website' )
239239
->setAttrib( 'placeholder', 'http://www.noc.example.com/' )

library/IXP/Form/Customer/BillingDetails.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class IXP_Form_Customer_BillingDetails extends IXP_Form
3535
public function init()
3636
{
3737
$billingContact = $this->createElement( 'text', 'billingContactName' );
38-
$billingContact->addValidator( 'stringLength', false, array( 0, 64 ) )
38+
$billingContact->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
3939
->setRequired( false )
4040
->setLabel( 'Contact' )
4141
->addFilter( 'StringTrim' )
@@ -45,7 +45,7 @@ public function init()
4545
$this->addElement( $billingContact );
4646

4747
$billingAddress1 = $this->createElement( 'text', 'billingAddress1' );
48-
$billingAddress1->addValidator( 'stringLength', false, array( 0, 64 ) )
48+
$billingAddress1->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
4949
->setRequired( false )
5050
->setLabel( 'Address' )
5151
->setAttrib( 'class', 'span6' )
@@ -55,7 +55,7 @@ public function init()
5555
$this->addElement( $billingAddress1 );
5656

5757
$billingAddress2 = $this->createElement( 'text', 'billingAddress2' );
58-
$billingAddress2->addValidator( 'stringLength', false, array( 0, 64 ) )
58+
$billingAddress2->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
5959
->setRequired( false )
6060
->setAttrib( 'class', 'span6' )
6161
->setLabel( '' )
@@ -65,7 +65,7 @@ public function init()
6565
$this->addElement( $billingAddress2 );
6666

6767
$billingAddress3 = $this->createElement( 'text', 'billingAddress3' );
68-
$billingAddress3->addValidator( 'stringLength', false, array( 0, 64 ) )
68+
$billingAddress3->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
6969
->setRequired( false )
7070
->setAttrib( 'class', 'span6' )
7171
->setLabel( '' )
@@ -75,7 +75,7 @@ public function init()
7575
$this->addElement( $billingAddress3 );
7676

7777
$billingCity = $this->createElement( 'text', 'billingTownCity' );
78-
$billingCity->addValidator( 'stringLength', false, array( 0, 64 ) )
78+
$billingCity->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
7979
->setRequired( false )
8080
->setAttrib( 'class', 'span4' )
8181
->setLabel( 'City' )
@@ -85,7 +85,7 @@ public function init()
8585
$this->addElement( $billingCity );
8686

8787
$billingPostcode = $this->createElement( 'text', 'billingPostcode' );
88-
$billingPostcode->addValidator( 'stringLength', false, array( 0, 64 ) )
88+
$billingPostcode->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
8989
->setRequired( false )
9090
->setAttrib( 'class', 'span4' )
9191
->setLabel( 'Postcode' )
@@ -118,7 +118,7 @@ public function init()
118118
$this->addElement( $billingEmail );
119119

120120
$billingTelephone = $this->createElement( 'text', 'billingTelephone' );
121-
$billingTelephone->addValidator( 'stringLength', false, array( 0, 64 ) )
121+
$billingTelephone->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
122122
->setRequired( false )
123123
->setAttrib( 'class', 'span6' )
124124
->setAttrib( 'placeholder', '+353 1 234 5678' )
@@ -131,7 +131,7 @@ public function init()
131131
/* Probably do not want to let the customer update this themselves...
132132
133133
$vatNumber = $this->createElement( 'text', 'vatNumber' );
134-
$vatNumber->addValidator( 'stringLength', false, array( 0, 64 ) )
134+
$vatNumber->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
135135
->setRequired( false )
136136
->setAttrib( 'class', 'span6' )
137137
->setLabel( 'VAT Number' )
@@ -141,7 +141,7 @@ public function init()
141141
$this->addElement( $vatNumber );
142142
143143
$vatRate = $this->createElement( 'text', 'vatRate' );
144-
$vatRate->addValidator( 'stringLength', false, array( 0, 64 ) )
144+
$vatRate->addValidator( 'stringLength', false, array( 0, 64, 'UTF-8' ) )
145145
->setRequired( false )
146146
->setAttrib( 'class', 'span4' )
147147
->setLabel( 'VAT Rate' )

0 commit comments

Comments
 (0)