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

Bug: CacheKey::getValuesFromBindings(): Return value must be of type string, null returned | when where value is null #468

Open
srezaFallahi opened this issue Jun 15, 2024 · 1 comment

Comments

@srezaFallahi
Copy link

Describe the bug
when where value is null occurred this error , elequent support value null in where clause like this => $query->where('key',null)->get();
but in this package throw exception
Eloquent Query
Please provide the complete eloquent query that caused the bug, for example:

$query->where('key',null)->get();

Stack Trace
{
"message": "GeneaLabs\LaravelModelCaching\CacheKey::getValuesFromBindings(): Return value must be of type string, null returned",
"exception": "TypeError",
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/CacheKey.php",
"line": 367,
"trace": [
{
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/CacheKey.php",
"line": 317,
"function": "getValuesFromBindings",
"class": "GeneaLabs\LaravelModelCaching\CacheKey",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/CacheKey.php",
"line": 232,
"function": "getValuesClause",
"class": "GeneaLabs\LaravelModelCaching\CacheKey",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/CacheKey.php",
"line": 379,
"function": "getOtherClauses",
"class": "GeneaLabs\LaravelModelCaching\CacheKey",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php",
"line": 791,
"function": "GeneaLabs\LaravelModelCaching\{closure}",
"class": "GeneaLabs\LaravelModelCaching\CacheKey",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/CacheKey.php",
"line": 382,
"function": "reduce",
"class": "Illuminate\Support\Collection",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/CacheKey.php",
"line": 53,
"function": "getWhereClauses",
"class": "GeneaLabs\LaravelModelCaching\CacheKey",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/Traits/Caching.php",
"line": 182,
"function": "make",
"class": "GeneaLabs\LaravelModelCaching\CacheKey",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/genealabs/laravel-model-caching/src/Traits/Buildable.php",
"line": 106,
"function": "makeCacheKey",
"class": "GeneaLabs\LaravelModelCaching\CachedBuilder",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/app/Http/Controllers/Api/PreOrderController.php",
"line": 632,
"function": "get",
"class": "GeneaLabs\LaravelModelCaching\CachedBuilder",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/app/Http/Controllers/Api/PreOrderController.php",
"line": 307,
"function": "editProductToPreOrder",
"class": "App\Http\Controllers\Api\PreOrderController",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
"line": 54,
"function": "edit",
"class": "App\Http\Controllers\Api\PreOrderController",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
"line": 43,
"function": "callAction",
"class": "Illuminate\Routing\Controller",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php",
"line": 21,
"function": "dispatch",
"class": "Illuminate\Routing\ControllerDispatcher",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingRoutingDispatcher.php",
"line": 29,
"function": "Sentry\Laravel\Tracing\Routing\{closure}",
"class": "Sentry\Laravel\Tracing\Routing\TracingControllerDispatcherTracing",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php",
"line": 20,
"function": "wrapRouteDispatch",
"class": "Sentry\Laravel\Tracing\Routing\TracingRoutingDispatcher",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 260,
"function": "dispatch",
"class": "Sentry\Laravel\Tracing\Routing\TracingControllerDispatcherTracing",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 205,
"function": "runController",
"class": "Illuminate\Routing\Route",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 806,
"function": "run",
"class": "Illuminate\Routing\Route",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 144,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/app/Http/Middleware/CheckUserIsActive.php",
"line": 30,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "App\Http\Middleware\CheckUserIsActive",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
"line": 50,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Routing\Middleware\SubstituteBindings",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
"line": 159,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
"line": 135,
"function": "handleRequest",
"class": "Illuminate\Routing\Middleware\ThrottleRequests",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
"line": 87,
"function": "handleRequestUsingNamedLimiter",
"class": "Illuminate\Routing\Middleware\ThrottleRequests",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Routing\Middleware\ThrottleRequests",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
"line": 57,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Auth\Middleware\Authenticate",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 119,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 807,
"function": "then",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 784,
"function": "runRouteWithinStack",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 748,
"function": "runRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 737,
"function": "dispatchToRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 200,
"function": "dispatch",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 144,
"function": "Illuminate\Foundation\Http\{closure}",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/FlushEventsMiddleware.php",
"line": 13,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Sentry\Laravel\Http\FlushEventsMiddleware",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestIpMiddleware.php",
"line": 45,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Sentry\Laravel\Http\SetRequestIpMiddleware",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestMiddleware.php",
"line": 31,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Sentry\Laravel\Http\SetRequestMiddleware",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php",
"line": 19,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Livewire\Features\SupportDisablingBackButtonCache\DisableBackButtonCacheMiddleware",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
"line": 31,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
"line": 40,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TrimStrings",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
"line": 99,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php",
"line": 39,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Illuminate\Http\Middleware\TrustProxies",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php",
"line": 97,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 183,
"function": "handle",
"class": "Sentry\Laravel\Tracing\Middleware",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 119,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 175,
"function": "then",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 144,
"function": "sendRequestThroughRouter",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/public/index.php",
"line": 55,
"function": "handle",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/home/sreza/projects/amadast-api/server.php",
"line": 21,
"function": "require_once"
}
]
}

Environment

  • PHP: 8.1
  • OS: Ubuntu 22.1
  • Laravel:10.45
  • Model Caching: 11
@daika7ana
Copy link

Hello!

I can't seem to reproduce the issue, is there any chance you can provide a PR with a failing test case or at least test repo that triggers this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants