@@ -116,7 +116,7 @@ protected static function iv_size()
116
116
*/
117
117
protected static function pad ($ value )
118
118
{
119
- $ pad = static ::$ block - (Str:: length ($ value ) % static ::$ block );
119
+ $ pad = static ::$ block - (strlen ($ value ) % static ::$ block );
120
120
121
121
return $ value .= str_repeat (chr ($ pad ), $ pad );
122
122
}
@@ -129,14 +129,7 @@ protected static function pad($value)
129
129
*/
130
130
protected static function unpad ($ value )
131
131
{
132
- if (MB_STRING )
133
- {
134
- $ pad = ord (mb_substr ($ value , -1 , 1 , Config::get ('application.encoding ' )));
135
- }
136
- else
137
- {
138
- $ pad = ord (substr ($ value , -1 ));
139
- }
132
+ $ pad = ord (substr ($ value , -1 ));
140
133
141
134
if ($ pad and $ pad <= static ::$ block )
142
135
{
@@ -145,12 +138,7 @@ protected static function unpad($value)
145
138
// as the padding appears to have been changed.
146
139
if (preg_match ('/ ' .chr ($ pad ).'{ ' .$ pad .'}$/ ' , $ value ))
147
140
{
148
- if (MB_STRING )
149
- {
150
- return mb_substr ($ value , 0 , Str::length ($ value ) - $ pad , Config::get ('application.encoding ' ));
151
- }
152
-
153
- return substr ($ value , 0 , Str::length ($ value ) - $ pad );
141
+ return substr ($ value , 0 , strlen ($ value ) - $ pad );
154
142
}
155
143
156
144
// If the padding characters do not match the expected padding
0 commit comments