Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] Fix exception/warning for PHP 7.2. #1465

Merged
merged 2 commits into from
Oct 25, 2017
Merged

Conversation

CristianDeluxe
Copy link
Contributor

When you use:

Datatables::of(User::all())->toJson()

In PHP 7.2 you will get:

PHP Warning: count(): Parameter must be an array or an object that implements Countable in yajra/laravel-datatables-oracle/src/CollectionDataTable.php on line 69

This creates an empty array if get request it's not defined so count() doesn't fail.

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in yajra/laravel-datatables-oracle/src/CollectionDataTable.php on line 69
@@ -65,7 +65,7 @@ public function count()
*/
public function columnSearch()
{
$columns = $this->request->get('columns');
$columns = $this->request->get('columns') ?: [];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to use the default value arg of get? Thanks!

$this->request->get('columns', []);

@yajra yajra changed the title Fix exception/warning for PHP 7.2 [8.0] Fix exception/warning for PHP 7.2 Oct 24, 2017
@yajra yajra changed the title [8.0] Fix exception/warning for PHP 7.2 [8.0] Fix exception/warning for PHP 7.2. Oct 24, 2017
@yajra yajra merged commit e90c49c into yajra:8.0 Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants