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

Soft delete "count" warning Laravel 5.3 PHP 5.6 #27968

Closed
mtvbrianking opened this issue Mar 22, 2019 · 2 comments
Closed

Soft delete "count" warning Laravel 5.3 PHP 5.6 #27968

mtvbrianking opened this issue Mar 22, 2019 · 2 comments

Comments

@mtvbrianking
Copy link

  • Laravel Version: 5.3.* to 5.5.*
  • PHP Version: 5.6.4 to 7.0.33
  • Database Driver & Version: MySQL 5.0.12

Description:

Am developing a package and I need to support people still using lower Laravel versions.

But I run into this error;

PHP Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\laravel-53\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php on line 1231

Note: I understand this issue was resolved for PHP 7.2 #22858 and #20258 but is there a fix or workaround for lower PHP versions..!?

Upgrading to PHP 7.1 is impossible because different package users can opt for the lowest support PHP version.

Is there a way to override (in my model); callScope() for getDeletedAtColumn() is already fixed.

Steps To Reproduce:

{
    ...
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*"
    },
    "config": {
        "platform": {
            "php": "5.6.4"
        }
    }
}

Simply fix your PHP version to the lowest acceptable.

App\User::count();

@driesvints
Copy link
Member

I can't help you out for 5.3 & 5.4 since we don't support those anymore, sorry. Are you absolutely sure you're experiencing this on 5.5 as well? Because it seems to me that the prs you're linking to indicate that the problems were fixed for 5.5.

@mtvbrianking
Copy link
Author

@driesvints update my testbed Laravel versions; I can confirm the issue is only persistent on only Laravel 5.3.

I created a new branch for my package to handle this breaking changes in Laravel 5.3

mtvbrianking added a commit to mtvbrianking/laravel-mtn-momo that referenced this issue Aug 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants