Skip to content

Commit

Permalink
Merge pull request #4493 from Polfo/4.1
Browse files Browse the repository at this point in the history
Fix `mb_strwidth()` Passing null to parameter 1 is deprecated #4492
  • Loading branch information
tabacitu committed Jul 19, 2022
2 parents 248e2e0 + 0184c7a commit 6c335a8
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function backpack_user()
*/
function mb_ucfirst($string, $encoding = false)
{
$string = $string ?? '';
$encoding = $encoding ? $encoding : mb_internal_encoding();

$strlen = mb_strlen($string, $encoding);
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/columns/email.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$column['text'] = '-';
if(!empty($value)) {
$column['text'] = $column['prefix'].Str::limit(strip_tags($value), $column['limit'], "[...]").$column['suffix'];
$column['text'] = $column['prefix'].Str::limit(strip_tags($value ?? ''), $column['limit'], "[...]").$column['suffix'];
}
@endphp

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/columns/model_function.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$column['prefix'] = $column['prefix'] ?? '';
$column['suffix'] = $column['suffix'] ?? '';
$column['text'] = $column['prefix'].
Str::limit($value, $column['limit'], "[...]").
Str::limit($value ?? '', $column['limit'], "[...]").
$column['suffix'];
@endphp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$column['prefix'] = $column['prefix'] ?? '';
$column['suffix'] = $column['suffix'] ?? '';
$column['text'] = $column['prefix'].
Str::limit($value, $column['limit'], "[...]").
Str::limit($value ?? '', $column['limit'], "[...]").
$column['suffix'];
@endphp

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/columns/phone.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$column['text'] = '';
if(!empty($value)) {
$column['text'] = $column['prefix'].Str::limit(strip_tags($value), $column['limit'], "[...]").$column['suffix'];
$column['text'] = $column['prefix'].Str::limit(strip_tags($value ?? ''), $column['limit'], "[...]").$column['suffix'];
}
@endphp

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/columns/row_number.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$column['prefix'] = $column['prefix'] ?? '';
$column['suffix'] = $column['suffix'] ?? '';
$column['text'] = $column['prefix'].
Str::limit(strip_tags($rowNumber), $column['limit'], "[...]").
Str::limit(strip_tags($rowNumber ?? ''), $column['limit'], "[...]").
$column['suffix'];
@endphp

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/columns/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$attributes = $crud->getRelatedEntriesAttributes($entry, $column['entity'], $column['attribute']);
foreach ($attributes as $key => &$text) {
$text = Str::limit($text, $column['limit'], '[...]');
$text = Str::limit($text ?? '', $column['limit'], '[...]');
}
@endphp

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/columns/select_multiple.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
foreach ($results_array as $key => $text) {
$results_array[$key] = Str::limit($text, $column['limit'], '[...]');
$results_array[$key] = Str::limit($text ?? '', $column['limit'], '[...]');
}
@endphp

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/columns/text.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$column['limit'] = $column['limit'] ?? 40;
$column['prefix'] = $column['prefix'] ?? '';
$column['suffix'] = $column['suffix'] ?? '';
$column['text'] = $column['prefix'].Str::limit($value, $column['limit'], '[...]').$column['suffix'];
$column['text'] = $column['prefix'].Str::limit($value ?? '', $column['limit'], '[...]').$column['suffix'];
@endphp

<span>
Expand Down

0 comments on commit 6c335a8

Please sign in to comment.